This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/38485
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 18 Dec 2008 10:54:34 -0500
- Subject: C++ PATCH for c++/38485
This turns out not to be related to my patch for c++/57 as I thought.
The problem was that we're trying to resolve the ambiguity of (type()),
which can be either an explicit temporary of type or a cast to "function
returning type". The resolution depends on the following token, and the
relevant function wasn't handling the case of no following token.
Tested x86_64-pc-linux-gnu, applied to trunk.
2008-12-18 Jason Merrill <jason@redhat.com>
PR c++/38485
* parser.c (cp_parser_token_starts_cast_expression): An EOF
can't start a cast-expression.
* g++.dg/parse/defarg13.C: New test.
Index: cp/parser.c
===================================================================
*** cp/parser.c (revision 142799)
--- cp/parser.c (working copy)
*************** cp_parser_token_starts_cast_expression (
*** 5953,5958 ****
--- 5953,5959 ----
case CPP_XOR:
case CPP_OR:
case CPP_OR_OR:
+ case CPP_EOF:
return false;
/* '[' may start a primary-expression in obj-c++. */
Index: testsuite/g++.dg/parse/defarg13.C
===================================================================
*** testsuite/g++.dg/parse/defarg13.C (revision 0)
--- testsuite/g++.dg/parse/defarg13.C (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/38485
+
+ template <class Key, class T>
+ class QMap { };
+
+ class XMLConfigurations {
+ void translateToOther(QMap<int, int> match = (QMap<int, int>()));
+ };