c++/2101: expression in structure initializer in template causes ICE

niemayer@isg.de niemayer@isg.de
Mon Feb 26 08:46:00 GMT 2001


>Number:         2101
>Category:       c++
>Synopsis:       expression in structure initializer in template causes ICE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 26 08:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Peter Niemayer
>Release:        gcc 2.95.2 (tested unsupported 2.96 20000731 as well, same bug)
>Organization:
>Environment:
any (tested on linux x86, alpha, hp-ux)
>Description:
Compiling the tiny test source causes gcc to emit an ICE.
The syntax may not be C++ standard, but it is documented
to work as a gcc extension (and usually does, just not in
this context):

gcc -c bug.cxx
bug.cxx: In function `void foo()':
bug.cxx:10: Internal compiler error.
bug.cxx:10: Please submit a full bug report.
bug.cxx:10: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

>How-To-Repeat:
class bar {
public:
        int operator=(const unsigned long x[1]) { return 1; }
};

template<class T>
void foo(void) {
        bar x;
        x = ( (const unsigned long [1]) { 5 } );   // works as expected
        x = ( (const unsigned long [1]) { 5-1 } ); // ICE
}
>Fix:
none (except for avoiding to use this kind of structure
initialization in templates)
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list