[Bug c++/60067] New: bogus error default template arguments may not be used in function templates
msebor at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 4 21:49:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60067
Bug ID: 60067
Summary: bogus error default template arguments may not be used
in function templates
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gmail dot com
GCC 4.8.2 issues the bogus error below on the following valid C++ '98 program.
Instantiating C (or the whole definition of foo) isn't necessary to trigger the
error.
$ cat u.cpp && g++ -c -o/dev/null u.cpp
template <class> struct A;
template <class> struct B { enum { v = 1 }; };
template <class T = void (A<int>)>
struct C {
void f () {
void g (int [B<T>::v]);
}
};
void foo (void) {
C<int>().f ();
}
u.cpp: In member function ‘void C<T>::f()’:
u.cpp:7:26: error: default template arguments may not be used in function
templates without -std=c++11 or -std=gnu++11
void g (int [B<T>::v]);
^
More information about the Gcc-bugs
mailing list