This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11858] Name lookup error ignored when instantiated from expression within sizeof() in template function parameter
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2003 15:52:42 -0000
- Subject: [Bug c++/11858] Name lookup error ignored when instantiated from expression within sizeof() in template function parameter
- References: <20030808221252.11858.gccbugs@contacts.eelis.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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,