* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
@ 2004-05-17 8:10 ` gianni at mariani dot ws
2004-05-17 8:28 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gianni at mariani dot ws @ 2004-05-17 8:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gianni at mariani dot ws 2004-05-16 21:29 -------
Adding ice-on-valid-code kw.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
2004-05-17 8:10 ` [Bug c++/15480] " gianni at mariani dot ws
@ 2004-05-17 8:28 ` pinskia at gcc dot gnu dot org
2004-05-17 14:36 ` giovannibajo at libero dot it
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 8:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-16 21:39 -------
Confirmed.
Here is a simplied example (it might be turned into invalid though):
template <unsigned int w_siz>
struct MPT_IntToType
{
typedef char type;
};
template <typename w_D>
struct MPT_Finder_Member
{
template <typename w_T>
static int finder(
const w_T *,
typename MPT_IntToType<
sizeof(w_T().Function())
>::type * = 0
);
static int finder( const w_D * );
};
template <typename w_D >
struct MPT_ContainsFuncMember
{
struct DerivedClass : w_D{};
typedef DerivedClass * DerivedClassp;
enum {
value = (
sizeof( MPT_Finder_Member<w_D>::finder( DerivedClassp() ) )
== sizeof( int)
)
};
};
struct A{};
int t = MPT_ContainsFuncMember<A>::value;
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-05-16 21:39:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
2004-05-17 8:10 ` [Bug c++/15480] " gianni at mariani dot ws
2004-05-17 8:28 ` pinskia at gcc dot gnu dot org
@ 2004-05-17 14:36 ` giovannibajo at libero dot it
2004-05-17 15:33 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-05-17 14:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-05-17 00:47 -------
Fails with 3.2.3, 3.3.3, 3.4.0 and current mainline. Interestingly enough, it
used to work with 3.4.0 20040216.
What does it happen with 2.95?
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |3.2.3 3.3.3 3.4.0 3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
` (2 preceding siblings ...)
2004-05-17 14:36 ` giovannibajo at libero dot it
@ 2004-05-17 15:33 ` pinskia at gcc dot gnu dot org
2004-05-17 19:16 ` gianni at mariani dot ws
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 15:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-17 00:57 -------
2.95.3 and 3.0.4 fails (I had forgot to fill in known to fail, woops).
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|3.2.3 3.3.3 3.4.0 3.5.0 |3.2.3 3.3.3 3.4.0 3.5.0
| |2.95.3 3.0.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
` (3 preceding siblings ...)
2004-05-17 15:33 ` pinskia at gcc dot gnu dot org
@ 2004-05-17 19:16 ` gianni at mariani dot ws
2004-05-17 19:16 ` bangerth at dealii dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gianni at mariani dot ws @ 2004-05-17 19:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gianni at mariani dot ws 2004-05-17 03:48 -------
I get this error when removing the templates:
xx6.cpp:43: sorry, unimplemented: call_expr cannot be mangled due to a defect in
the C++ ABI
------------------------------
typedef char MPT_False;
typedef int MPT_True;
template <unsigned w_siz>
struct MPT_IntToType
{
typedef char type[ 1 ];
};
struct B
{
int Function();
};
struct DerivedClass_B : B
{
};
struct FinderM
{
template <typename w_T>
static MPT_True finder(
const w_T *,
typename MPT_IntToType<
sizeof(static_cast<w_T *>(0)->Function())
>::type * = 0
);
static MPT_False finder( const B * );
};
bool value =
sizeof( FinderM::finder( static_cast<DerivedClass_B *>(0) ) ) == sizeof(
MPT_True );
------------------------------
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
` (4 preceding siblings ...)
2004-05-17 19:16 ` gianni at mariani dot ws
@ 2004-05-17 19:16 ` bangerth at dealii dot org
2004-05-17 19:32 ` gianni at mariani dot ws
2005-01-06 2:01 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-05-17 19:16 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
` (5 preceding siblings ...)
2004-05-17 19:16 ` bangerth at dealii dot org
@ 2004-05-17 19:32 ` gianni at mariani dot ws
2005-01-06 2:01 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: gianni at mariani dot ws @ 2004-05-17 19:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gianni at mariani dot ws 2004-05-17 06:26 -------
I don't know if this is related to this bug but I think this code is also not
correctly parsed by gcc. Again comeau compiles this fine and MSVC ++ gets all
confused about not being able to deduce func in a similar way to gcc.
typedef char MPT_False;
typedef int MPT_True;
template <unsigned int w_siz>
struct MPT_IntToType
{
typedef char type;
};
template <typename T1, typename T2>
int func( T2 ( T1::* )() );
template <typename w_D>
struct MPT_Finder_Member
{
template <typename w_T>
static MPT_True finder(
const w_T *,
typename MPT_IntToType<
sizeof( func( & w_T::Function ) )
>::type * = 0
);
static MPT_False finder( const w_D * );
};
template <typename w_D >
struct MPT_ContainsFuncMember
{
struct DerivedClass : w_D
{
};
typedef DerivedClass * DerivedClassp;
enum {
value = (
sizeof( MPT_Finder_Member<w_D>::finder( DerivedClassp() ) )
== sizeof( MPT_True )
)
};
};
struct A
{
};
struct B
{
int Function();
};
// this works find so func<T1,T2> can be deduced
int x = sizeof( func( &B::Function ) );
int y = MPT_ContainsFuncMember<A>::value;
int z = MPT_ContainsFuncMember<B>::value;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15480] ICE with sizeof(T().f()) as template parameter in function resolution
2004-05-17 8:02 [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution gianni at mariani dot ws
` (6 preceding siblings ...)
2004-05-17 19:32 ` gianni at mariani dot ws
@ 2005-01-06 2:01 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-06 2:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-06 02:01 -------
(In reply to comment #5)
> Here is a yet simpler example:
We reject this now (and not ICE).
> I wonder if this is somehow related to the fact that we
> (spuriously) don't accept this code (the same as above,
And we reject this still.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Last reconfirmed|2004-05-16 21:39:06 |2005-01-06 02:01:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
^ permalink raw reply [flat|nested] 9+ messages in thread