From mboxrd@z Thu Jan 1 00:00:00 1970 From: sebor@roguewave.com To: gcc-gnats@gcc.gnu.org Subject: c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template Date: Tue, 31 Jul 2001 14:56:00 -0000 Message-id: <20010731215515.18417.qmail@sourceware.cygnus.com> X-SW-Source: 2001-07/msg00834.html List-Id: >Number: 3905 >Category: c++ >Synopsis: gcc 3.0 bogus error on sizeof (nested-type) in a template >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Jul 31 14:56:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: sebor@roguewave.com >Release: gcc 3.0 >Organization: >Environment: >Description: This fails to compile with 2.95.2, 2.96 and 3.0. It is reduced from our implementation of type traits. Regards Martin $ cat t.cpp ; g++ t.cpp template struct S { struct A { }; struct B { int i [2]; }; struct C { C (int); }; static A foo (int, ...); static B foo (int, C); static T bar (); enum { val = sizeof (B) == sizeof (foo (0, bar ())) }; }; int main () { return S::val; } t.cpp: In instantiation of `S': t.cpp:22: instantiated from here t.cpp:22: invalid use of undefined type `struct S' t.cpp:17: forward declaration of `struct S' t.cpp:22: invalid use of undefined type `struct S' t.cpp:17: forward declaration of `struct S' >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: