[Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Mon May 17 19:16:00 GMT 2004
------- Additional Comments From bangerth at dealii dot org 2004-05-17 02:56 -------
Here is a yet simpler example:
-------------------
template <int> struct S {};
template <int> struct G {
template <typename U>
static int finder(U *, S< sizeof(U().foo()) > * = 0);
static int finder (int *);
};
int t = sizeof( G<1>::finder( (int*)0 ) );
---------------------
We ICE on this:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In instantiation of `G<1>':
x.cc:10: instantiated from here
x.cc:5: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I wonder if this is somehow related to the fact that we
(spuriously) don't accept this code (the same as above,
just that G isn't a template:
-------------------
template <int> struct S {};
struct G {
template <typename U>
static int finder(U *, S< sizeof(U().foo()) > * = 0);
static int finder (int *);
};
int t = sizeof( G::finder( (int*)0 ) );
--------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:10: error: request for member `foo' in `0', which is of non-class type
`int'
This should be just a SFINAE.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
More information about the Gcc-bugs
mailing list