public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template
@ 2001-07-31 14:56 sebor
  0 siblings, 0 replies; 2+ messages in thread
From: sebor @ 2001-07-31 14:56 UTC (permalink / raw)
  To: gcc-gnats

>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:


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

* Re: c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template
@ 2001-07-31 20:10 ljrittle
  0 siblings, 0 replies; 2+ messages in thread
From: ljrittle @ 2001-07-31 20:10 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, sebor

Synopsis: gcc 3.0 bogus error on sizeof (nested-type) in a template

State-Changed-From-To: open->analyzed
State-Changed-By: ljrittle
State-Changed-When: Tue Jul 31 20:10:57 2001
State-Changed-Why:
    I have provided the long-known work-around to this problem
    in the Fix section.  This PR should be closed once the
    new C++ parser code is installed since it currently
    compiles the example (assuming it still does at that
    point - I could find no existing test case for this
    exact problem, perhaps one should be installed XFAILing).

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3905&database=gcc


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

end of thread, other threads:[~2001-07-31 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-31 14:56 c++/3905: gcc 3.0 bogus error on sizeof (nested-type) in a template sebor
2001-07-31 20:10 ljrittle

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).