re PR c++/60409 ([c++1y] ICE on valid with template function)

PR c++/60409
	* semantics.c (force_paren_expr): Only add a PAREN_EXPR to a
	dependent expression.

From-SVN: r208352
This commit is contained in:
Jason Merrill 2014-03-05 14:25:37 -05:00 committed by Jason Merrill
parent 5d264d62dc
commit f9b381b8eb
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2014-03-05 Jason Merrill <jason@redhat.com>
PR c++/60409
* semantics.c (force_paren_expr): Only add a PAREN_EXPR to a
dependent expression.
PR c++/60361
* parser.c (cp_parser_template_id): Don't set up a CPP_TEMPLATE_ID
if re-parsing might succeed.

View File

@ -1609,7 +1609,7 @@ force_paren_expr (tree expr)
&& TREE_CODE (expr) != SCOPE_REF)
return expr;
if (processing_template_decl)
if (type_dependent_expression_p (expr))
expr = build1 (PAREN_EXPR, TREE_TYPE (expr), expr);
else
{

View File

@ -0,0 +1,12 @@
// PR c++/60409
// { dg-options -std=c++1y }
struct A
{
void foo();
};
template<typename T> void bar(T)
{
(A().foo)();
}