gcc-4.1 crashes on templated class with a member function as argument with member function type default value assigned as template parameter default value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.1 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gcc-4.1
G++-4.1 on ubuntu does not seem to handle the following functionality of C++ templated classes.
The error message given is :
test00.cpp:58: internal compiler error: in uses_template_
NOTE: G++-4.2 won't report any error, and won't build the source (like 3.4)
template <typename C, typename T>
struct Delegate
{
typedef void (C::*type)(T& outValue);
};
template <typename C, typename T,
typename Delegate<C, T>::type IF_NEEDED = typename Delegate<C, T>::type() >
struct Member
{
T& FValue;
C& FOwner;
Member(C& parOwner) : FValue (), FOwner (parOwner) {}
T& Read() { if (IF_NEEDED != typename Delegate<C, T>::type()) (FOwner.
};
ProblemType: Crash
Architecture: i386
Date: Mon May 5 03:05:44 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/lib/
Package: g++-4.1 4.1.2-21ubuntu1
PackageArchitec
SourcePackage: gcc-4.1
Uname: Linux 2.6.24-16-generic i686
the ICE is fixed in gcc-4.2 (hardy) and gcc-4.3 (intrepid).
$ g++ -Wall test00.cpp int>::TSlot( int Test::*)' ::TSlot( const TSlot<int>&) int>::TSlot( int Test::*)' ::TSlot( const TSlot<int>&) string< _CharT, _Traits, _Alloc> ::basic_ string( const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_ traits< char>, _Alloc = std::allocator< char>]'
test00.cpp:57: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
test00.cpp:57: error: template argument 3 is invalid
test00.cpp:65: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
test00.cpp:65: error: template argument 3 is invalid
test00.cpp: In instantiation of 'TSlot<int>':
test00.cpp:61: instantiated from here
test00.cpp:43: error: 'int' is not a class, struct, or union type
test00.cpp:44: error: 'int' is not a class, struct, or union type
test00.cpp:45: error: 'int' is not a class, struct, or union type
test00.cpp:47: error: 'int' is not a class, struct, or union type
test00.cpp:49: error: 'int' is not a class, struct, or union type
test00.cpp:51: error: 'int' is not a class, struct, or union type
test00.cpp:52: error: 'int' is not a class, struct, or union type
test00.cpp: In static member function 'static const TSlot<int>& Test::SlotName()':
test00.cpp:61: error: no matching function for call to 'TSlot<
test00.cpp:41: note: candidates are: TSlot<int>
test00.cpp: In static member function 'static const TSlot<int>& Test::SlotAge()':
test00.cpp:69: error: no matching function for call to 'TSlot<
test00.cpp:41: note: candidates are: TSlot<int>
test00.cpp: In constructor 'Test::Test()':
test00.cpp:73: error: cannot convert 'Test' to 'int' in initialization
test00.cpp:73: error: cannot convert 'Test' to 'int' in initialization
test00.cpp: In function 'int main()':
test00.cpp:83: error: cannot convert 'std::string' to 'int' in assignment
test00.cpp:85: error: invalid type argument of 'unary *'
test00.cpp:85: error: invalid type argument of 'unary *'
test00.cpp:87: error: invalid conversion from 'int' to 'const char*'
test00.cpp:87: error: initializing argument 1 of 'std::basic_