This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template
- From: sebor at roguewave dot com
- Date: 31 Jul 2001 21:55:15 -0000
- Reply-To: sebor at roguewave dot com
>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 <class T>
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<char>::val;
}
t.cpp: In instantiation of `S<char>':
t.cpp:22: instantiated from here
t.cpp:22: invalid use of undefined type `struct S<char>'
t.cpp:17: forward declaration of `struct S<char>'
t.cpp:22: invalid use of undefined type `struct S<char>'
t.cpp:17: forward declaration of `struct S<char>'
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: