[Bug c++/11858] Name lookup error ignored when instantiated from expression within sizeof() in template function parameter
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Sat Aug 9 15:52: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
------- Additional Comments From bangerth at dealii dot org 2003-08-09 15:52 -------
I'm not where exactly is the bug here: T::x doesn't exist if T=int, so this is a substitution
failure. This is not an error, the function is simply not available for name lookup. If this
were the correct interpretation, then we should get an error that there is no suitable
function T::f in the sizeof expression. But there's a bug anyway.
By the way, this is rejected:
---------------------------------------------
template <int> struct X {};
template <typename T> struct S { static typename T::x f (); };
template <class T> int f (X<sizeof(T::f())> *);
int const i = f<S<int> >(0);
----------------------------------------------
So it has something to do with the fact that gcc simply ignores the size expression if
an argument to a function is an array.
W,
More information about the Gcc-bugs
mailing list