This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/60409 (ICE with non-dependent call in c++1y mode)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 05 Mar 2014 14:24:53 -0500
- Subject: C++ PATCH for c++/60409 (ICE with non-dependent call in c++1y mode)
- Authentication-results: sourceware.org; auth=none
Various code was being confused by the PAREN_EXPR. Let's only add them
when the expression is dependent.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 96995b9f04091798416d64c572950df31d3add8a
Author: Jason Merrill <jason@redhat.com>
Date: Wed Mar 5 13:19:16 2014 -0500
PR c++/60409
* semantics.c (force_paren_expr): Only add a PAREN_EXPR to a
dependent expression.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4081e0e..d2c453f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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
index 0000000..94b00eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/regress1.C
@@ -0,0 +1,12 @@
+// PR c++/60409
+// { dg-options -std=c++1y }
+
+struct A
+{
+ void foo();
+};
+
+template<typename T> void bar(T)
+{
+ (A().foo)();
+}