]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60409 ([c++1y] ICE on valid with template function)
authorJason Merrill <jason@redhat.com>
Wed, 5 Mar 2014 19:25:37 +0000 (14:25 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 5 Mar 2014 19:25:37 +0000 (14:25 -0500)
PR c++/60409
* semantics.c (force_paren_expr): Only add a PAREN_EXPR to a
dependent expression.

From-SVN: r208352

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp1y/regress1.C [new file with mode: 0644]

index 9e7b9b77c9cd3ed065c269f1673ae794ef7d2be8..a0b87bf91af8555df8f109d8b4dc9ab3def97c78 100644 (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.
index 4081e0ec1d577339e668e82da787c5a7ccf1c5f2..d2c453fc658e6454850a4ceceb3f82e20ddfc518 100644 (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
     {
diff --git a/gcc/testsuite/g++.dg/cpp1y/regress1.C b/gcc/testsuite/g++.dg/cpp1y/regress1.C
new file mode 100644 (file)
index 0000000..94b00eb
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/60409
+// { dg-options -std=c++1y }
+
+struct A
+{
+  void foo();
+};
+
+template<typename T> void bar(T)
+{
+  (A().foo)();
+}