The following example program produces several unwarranted "declaration ...
does not declare anything" warnings. This problem is also present in gcc 4.3,
since this is when the warning was introduced.
File /tmp/warning.cc:
class C1 {
public: class C2 { };
};
void cf1 (class C1::C2, void*); // Should not provoke a warning
void cf2 (void*, class C1::C2);
void cf3 (C1::C2, void*);
namespace N {
enum E1 { foo };
enum E2 { bar };
template <class X>
class TC1 { };
template <class T, class U>
class TC2 : public TC1<T> { };
}
void
tcf1 (N::TC2<enum N::E1, void*> *arg1, // Should not provoke a warning
N::TC2<void*, enum N::E1> *arg2,
N::TC2<N::E1, void*> *arg3)
{
}
void *
tcf2 (void *x)
{
return (void *)
(N::TC2<enum N::E1, void*> *) // Should not provoke a warning
(N::TC2<void*, enum N::E1> *)
(N::TC2<N::E1, void*> *)
x;
}
/tmp/warning.cc:5: warning: declaration 'class C1::C2' does not declare
anything
/tmp/warning.cc:23: warning: declaration 'enum N::E1' does not declare anything
/tmp/warning.cc: In function 'void* tcf2(void*)':
/tmp/warning.cc:33: warning: declaration 'enum N::E1' does not declare anything
--
Summary: Erroneous "declaration 'class ...' does not declare
anything" warnings possible
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: simon_baldwin at yahoo dot com
GCC target triplet: i386-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36999