delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/02/26/13:52:42

From: jonathan AT westwood DOT com (Jonathan Lanier)
Subject: BUG: Struct declarations in template funcs crash b17.1
26 Feb 1997 13:52:42 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.SOL.3.91.970226122817.7286A-100000.cygnus.gnu-win32@westmain>
Mime-Version: 1.0
Original-To: Win32 Mailing List <gnu-win32 AT cygnus DOT com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I was able to narow down the problem I reported earlier with the internal 
compiler error.  After cutting and hacking at the preprocessed output, I 
narrowed it down to this simple test case:

template<class T> T Foo(T arg)
{
    struct
    {
        int val1;
    } watch_me_blow_up;
}

This crashes the compiler.  Although the code is useless, it illustrates 
that the act of even declaring a new type of struct or class inside a 
template function will cause the error to occur.  All you have to do is 
type the above into a file called test.cpp and type GCC TEST.CPP and 
watch the fireworks.

Any comments, anyone?

- Jonathan Lanier
  jonathan AT westwood DOT com

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019