[Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace

wirawan0 at softhome dot net gcc-bugzilla@gcc.gnu.org
Fri Oct 10 15:58:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12570

           Summary: G++ fails to accept a legal struct declaration in a
                    namespace
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wirawan0 at softhome dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

Under certain circumstance, g++ fails to accept a legal C-style struct declaration in namespace, for example:

#include <complex>  // complex is defined here, but under namespace std

namespace f2c {
  typedef struct { real r, i; } complex; // *GCC SAYS ERROR
}

GCC gives the following error on the ERROR line above:
error: semicolon missing after struct declaration
error: abstract declarator `f2c::<anonymous  struct>' used as declaration
error: namespace-scope anonymous aggregates must be static

Somehow this only happens when the source code is very complex. I will send you a (preprocessed) sample code that cause G++ to stumble. Or send me an email for the code if the attachment does not appear soon.



More information about the Gcc-bugs mailing list