strange warning
G++ emits strange warning. It is really annoying me, because I include similar
header to many files.
This is the code.
=== begin ===
template <class _TTN, class _TNK>
class A
{
//public:
private:
typedef _TTN _TN;
};
template <class _NY, class _TN>
class B : virtual public A <_TN, _NY>
{
_TN func () = 0;
};
=== end ===
This warning message is emitted (command is "g++ -c error.cpp"):
=== begin ===
error.cpp:13: warning: lookup of `_TN' finds `class _TN'
error.cpp:13: warning: instead of `typename B<_NY,_TN>::_TN' from dependent
base class
error.cpp:13: warning: (use `typename B::_TN' if that's what you meant)
=== end ===
Note that if you displace template parameters, i.e. write "template <class _TN,
class _NY>", this annoying warning won't be emitted.
I think, this is a compiler bug.
This bug takes place in (almost) any version of g++ in Debian (from 2.95.2 to
3.0.1-pre010811).
I haven't tried 3.0.2-pre.
Reply to: