This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/4926: Segmentation Fault on Legal Code
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: gcc-bugs at gcc dot gnu dot org, <gcc-gnats at gcc dot gnu dot org>
- Date: Fri, 1 Nov 2002 14:31:33 -0600 (CST)
- Subject: Re: c++/4926: Segmentation Fault on Legal Code
It's too bad that templates with typeof are still broken in some places,
since the (standards conforming) workarounds are also not working always.
Here's a redux of PR 4926:
--------------------------------------
template <unsigned> struct X { typedef int Type; };
template <typename T> struct Y { char array[1]; };
template<typename T> Y<T> P(T); // acts as "Y<typeof(T)>"
struct F { int operator()() const; };
template <typename T>
typename X<sizeof(P( T()() ).array)>::Type foo();
int main() { foo<F>(); };
--------------------------------------
By changing F::operator() into a "regular" member function, all sorts of
other bugs can be triggered before the compiler finally crashed :-(
Regards
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth