[Bug c++/11858] New: Name lookup error ignored when instantiated from expression within sizeof() in template function parameter
gccbugs at contacts dot eelis dot net
gcc-bugzilla@gcc.gnu.org
Fri Aug 8 22:12:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11858
Summary: Name lookup error ignored when instantiated from
expression within sizeof() in template function
parameter
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gccbugs at contacts dot eelis dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC accepts the following invalid code:
template <typename T> struct S { static typename T::x f (); };
template <class T> int f (int [sizeof(T::f())]);
int const i = f<S<int> >(0);
Comeau (4.3.3 beta) does the detect the error, and says:
line 1: error: name followed by "::" must be a class or namespace name
template <typename T> struct S { static typename T::x f (); };
^
detected during:
instantiation of class "S<T> [with T=int]" at line 2
instantiation of "f" based on template argument <S<int>> at line 3
I'm using GCC version 3.4 20030723.
More information about the Gcc-bugs
mailing list