This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]