c++/9333: [3.4 regression] new parser rejects creation of complex templated class temporaries
andrew@andypo.net
andrew@andypo.net
Wed Jan 15 20:39:00 GMT 2003
>Number: 9333
>Category: c++
>Synopsis: [3.4 regression] new parser rejects creation of complex templated class temporaries
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jan 15 12:26:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Andrew Pollard
>Release: gcc-3.4-20030115
>Organization:
>Environment:
i686-pc-linux-gnu on a PIII system
>Description:
This is probably related to the (now fixed) c++/9112
I assume that this is a bug in the new parser....
temporary.cxx:
--------------
template<int foo>
struct A1 {
A1(int, int, int) {}
};
template<int foo>
struct A2 {
A2(int, int) {}
};
template<int foo>
struct B {
int b;
void bar1() { A1<foo>(b, b, b); }
void bar2() { A2<foo>(b, b); }
void bar3() { A1<foo> a1(b, b, b); }
};
--------------
% gcc34 -c temporary.cxx
temporary.cxx: In member function `void B<foo>::bar1()':
temporary.cxx:14: error: expected init-declarator
temporary.cxx:14: error: expected `,' or `;'
bar2() [ not as many constructor arguments ] and bar3() [using an explicit temporary] work.
bar1() also works in gcc-3.3/gcc-3.2 and gcc-3.4 prior to the new parser merge.
I also tried the online Comeau-C++ compiler and Intel icc-7.0 and they both accepted the code as well.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list