This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Strange warning message


Hi,
Compiling the following file

---- tmp.cc ----
namespace N {

template <typename T>
class X
{
  union
  {
    int a;
    char b;
  };
};

}

using namespace N;

void main()
{
  X<int> x;
}
-------------------

with egcs-1.1 I received the following strange warnings:

tmp.cc: In instantiation of `::N::::N::X<int>':
tmp.cc:19:   instantiated from here
tmp.cc:8: warning: private member `int X<int>::{anonymous union}::a' in
anonymous union
tmp.cc:9: warning: private member `char X<int>::{anonymous union}::b' in
anonymous union

If I remove namespaces or if class X is not a template class, warnings are
not generated.
Is it normal behavior?

Regards,
Andrey.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]