c++/4926: Segmentation Fault on Legal Code
Wolfgang Bangerth
bangerth@ticam.utexas.edu
Fri Nov 1 12:36:00 GMT 2002
The following reply was made to PR c++/4926; it has been noted by GNATS.
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Cc:
Subject: Re: c++/4926: Segmentation Fault on Legal Code
Date: Fri, 1 Nov 2002 14:31:33 -0600 (CST)
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
More information about the Gcc-prs
mailing list