The following valid code snippet is rejected since GCC 3.4.0: ===================================================== template<typename> struct A { typedef int T; T foo(); A() { foo().~T(); } }; A<int> a; ===================================================== The error message is: bug.cc: In constructor 'A< <template-parameter-1-1> >::A()': bug.cc:6: error: expected class-name before '(' token The code compiles if A is a non-template class, or if I remove the typedef and call the anonymous template parameter "T" instead.
Testing a patch.
Subject: Bug 32384 Author: jakub Date: Thu Nov 1 22:54:39 2007 New Revision: 129836 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129836 Log: PR c++/32384 * parser.c (cp_parser_postfix_dot_deref_expression): If POSTFIX_EXPRESSION is type dependent, try to parse it as pseudo dtor first and if that succeeds and type is SCALAR_TYPE_P, create PSEUDO_DTOR_EXPR. * g++.dg/template/pseudodtor1.C: New test. * g++.dg/template/pseudodtor2.C: New test. Added: trunk/gcc/testsuite/g++.dg/template/pseudodtor1.C trunk/gcc/testsuite/g++.dg/template/pseudodtor2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk so far.
Closing 4.1 branch.
Closing 4.2 branch, fixed in 4.3.