Here is the code
//fail_.cpp
template< unsigned char X, class L>
class A {
public:
typedef void (A::*fptr)();
class B {
public: B(typename A< X, L> ::fptr );
};
};
template < unsigned char X, typename L >
A<X,L>::B::B ( fptr ) { }
g++ -c fail_.cpp
gives
fail_.cpp:11: internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source if appropriate.
See < file:///usr/share/doc/gcc-4.3/README.Bugs > for instructions.
Looks like a bug to me in g++4.3.5, g++4.4 and higher don't give any such segfault.
What do you guys think? Is there something wrong with the code itself?
I see a similar failure with gcc 4.2. As others have said, an internal error means something went badly wrong inside the compiler, which does not imply that it's your code that was bad.
It works fine in g++ 4.6 and clang 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With