This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15980] New: parse error caused by default initializer for a template type function argument
- From: "schoenebeck at software-engineering dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jun 2004 22:42:04 -0000
- Subject: [Bug c++/15980] New: parse error caused by default initializer for a template type function argument
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
We encountered that gcc fails to compile with a parse error if a template
based function argument is assigned a default initializer in the function
prototype. Here is a stand alone test case for the exact problem:
#define BUG
template<typename A, typename B>
struct C {};
typedef C<int, int> C_int_int;
int w_typedef(C<int,int> arg = C_int_int()) {
return 0;
}
int wo_typedef(C<int,int> arg = C<int,int>()) {
return 0;
}
struct S {
int w_typedef(C_int_int arg = C_int_int()) {
return 0;
}
#ifdef BUG
int wo_typedef(C<int, int> arg = C<int,int>()) {
return 0;
}
#endif
};
int main(int argc, char* argv[]) {
w_typedef();
wo_typedef();
S s;
s.w_typedef();
#ifdef BUG
s.wo_typedef();
#endif
return 0;
}
It compiles fine when BUG is not defined though. This code failed with
gcc 3.2.2, 3.3.3 and also with 3.4, using various distributions (e.g. Debian
and RedHat).
--
Summary: parse error caused by default initializer for a template
type function argument
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schoenebeck at software-engineering dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15980