This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 May 2004 02:56:46 -0000
- Subject: [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
- References: <20040516212738.15480.gianni@mariani.ws>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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