public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace
@ 2003-10-10 15:58 wirawan0 at softhome dot net
  2003-10-10 16:07 ` [Bug c++/12570] " wirawan0 at softhome dot net
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wirawan0 at softhome dot net @ 2003-10-10 15:58 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
@ 2003-10-10 16:07 ` wirawan0 at softhome dot net
  2003-10-10 16:14 ` wirawan0 at softhome dot net
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wirawan0 at softhome dot net @ 2003-10-10 16:07 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From wirawan0 at softhome dot net  2003-10-10 16:07 -------
Created an attachment (id=4914)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4914&action=view)
The stumbling source code

Here is the (initial part of) cc1plus output message:

GNU C++ version 3.3.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.1.
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32018
In file included from src/cp.inc/LAPACK_dsyevx.cpp:100,
		 from src/tbhqmc-dmc.cpp:160:
src/cp.inc/support/f2c.h:35: error: semicolon missing after struct declaration
src/cp.inc/support/f2c.h:35: error: abstract declarator `f2c::<anonymous 
   struct>' used as declaration
src/cp.inc/support/f2c.h:35: error: namespace-scope anonymous aggregates must 
   be static
src/tbhqmc-dmc.cpp:274: error: syntax error before `;' token
src/tbhqmc-dmc.cpp:282: error: syntax error before `;' token
[lots more message follows]

The stumbling source line is at line 42418 of file tbhqmc-dmc.ii.

Here's the command-line (invocation of cc1plus) that's known to give the same
error (the basepath of cc1plus may vary):

 /usr/local/gcc-3.3.1/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1plus
-fpreprocessed tbhqmc-dmc.ii -quiet -dumpbase tbhqmc-dmc.cpp -mcpu=i686
-march=i686 -minline-all-stringops -mcpu=i686 -march=i686
-minline-all-stringops -auxbase-strip objs-DEBUG/tbhqmc-dmc-1d.o -g -Wall
-Winline -version -fno-exceptions -o tbhqmc-dmc.s


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
  2003-10-10 16:07 ` [Bug c++/12570] " wirawan0 at softhome dot net
@ 2003-10-10 16:14 ` wirawan0 at softhome dot net
  2003-10-10 16:32 ` wirawan0 at softhome dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wirawan0 at softhome dot net @ 2003-10-10 16:14 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From wirawan0 at softhome dot net  2003-10-10 16:14 -------
Compiler's version info:

/usr/local/gcc-3.3 $ /usr/local/gcc-3.3.1/bin/g++ -v
Reading specs from /usr/local/gcc-3.3.1/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --prefix=/usr/local/gcc-3.3.1 --disable-nls --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.3.1


The exact same problem also appears on g++ version 3.2.2; here's the output string of that compiler:

Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long--enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
  2003-10-10 16:07 ` [Bug c++/12570] " wirawan0 at softhome dot net
  2003-10-10 16:14 ` wirawan0 at softhome dot net
@ 2003-10-10 16:32 ` wirawan0 at softhome dot net
  2003-10-10 16:51 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wirawan0 at softhome dot net @ 2003-10-10 16:32 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From wirawan0 at softhome dot net  2003-10-10 16:32 -------
TEMPORARY WORK-AROUND:

change the one line

  typedef struct {real r,i;} complex;

to two lines:
  struct complex { real r,i; }
  typedef struct complex complex;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
                   ` (2 preceding siblings ...)
  2003-10-10 16:32 ` wirawan0 at softhome dot net
@ 2003-10-10 16:51 ` gdr at integrable-solutions dot net
  2003-10-10 22:14 ` wirawan0 at softhome dot net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-10-10 16:51 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-10-10 16:51 -------
Subject: Re:  G++ fails to accept a legal struct declaration in a namespace

"wirawan0 at softhome dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| TEMPORARY WORK-AROUND:
| 
| change the one line
| 
|   typedef struct {real r,i;} complex;
| 
| to two lines:
|   struct complex { real r,i; }
--------------------------------^                               
|   typedef struct complex complex;

Did you really mean that?  There is a missing semicolon.

-- Gaby


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
                   ` (3 preceding siblings ...)
  2003-10-10 16:51 ` gdr at integrable-solutions dot net
@ 2003-10-10 22:14 ` wirawan0 at softhome dot net
  2003-10-16 19:10 ` bangerth at dealii dot org
  2003-12-09 18:33 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: wirawan0 at softhome dot net @ 2003-10-10 22:14 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From wirawan0 at softhome dot net  2003-10-10 22:13 -------
Re: Gaby's comment

Of course not! Sorry, a typo. Yes, a `;' should be THERE.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
                   ` (4 preceding siblings ...)
  2003-10-10 22:14 ` wirawan0 at softhome dot net
@ 2003-10-16 19:10 ` bangerth at dealii dot org
  2003-12-09 18:33 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2003-10-16 19:10 UTC (permalink / raw)
  To: gcc-bugs

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From bangerth at dealii dot org  2003-10-16 19:10 -------
This is a reduced testcase:
-----------------------
namespace NS1 {
  template <typename> struct S;
}
using namespace NS1;

namespace NS2 {
  typedef struct { } S;
}
-----------------------
It fails with all gcc versions up to 3.3:
g/x> /home/bangerth/bin/gcc-3.3.2-pre/bin/c++ -c x.cc
x.cc:7: error: semicolon missing after struct declaration
x.cc:7: error: abstract declarator `NS2::<anonymous struct>' used as
   declaration
x.cc:7: error: namespace-scope anonymous aggregates must be static

It succeeds to compile with present mainline, though, so it seems to be
fixed.

W.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/12570] G++ fails to accept a legal struct declaration in a namespace
  2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
                   ` (5 preceding siblings ...)
  2003-10-16 19:10 ` bangerth at dealii dot org
@ 2003-12-09 18:33 ` dhazeghi at yahoo dot com
  6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-09 18:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-12-09 18:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-10 15:58 [Bug c++/12570] New: G++ fails to accept a legal struct declaration in a namespace wirawan0 at softhome dot net
2003-10-10 16:07 ` [Bug c++/12570] " wirawan0 at softhome dot net
2003-10-10 16:14 ` wirawan0 at softhome dot net
2003-10-10 16:32 ` wirawan0 at softhome dot net
2003-10-10 16:51 ` gdr at integrable-solutions dot net
2003-10-10 22:14 ` wirawan0 at softhome dot net
2003-10-16 19:10 ` bangerth at dealii dot org
2003-12-09 18:33 ` dhazeghi at yahoo dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).