aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-12-20 13:38:30 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-12-20 13:38:30 -0500
commitb6b990219342543d804a269a5409091a93e6d2ea (patch)
tree7f077742cea14e877fc897396702f8cb1fd8ea01
parent60424a41dd3f7c186419903b4a15736d1f685421 (diff)
downloadgcc-b6b990219342543d804a269a5409091a93e6d2ea.zip
gcc-b6b990219342543d804a269a5409091a93e6d2ea.tar.gz
gcc-b6b990219342543d804a269a5409091a93e6d2ea.tar.bz2
re PR c++/67411 (internal compiler error: in tsubst_copy, at cp/pt.c:13473)
PR c++/67411 * decl2.c (decl_maybe_constant_var_p): A proxy isn't constant. From-SVN: r231862
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-const1.C18
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9b8c2ff..40ae390 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/67411
+ * decl2.c (decl_maybe_constant_var_p): A proxy isn't constant.
+
2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/68978
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 5ae6266..1e4282a 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4222,6 +4222,9 @@ decl_maybe_constant_var_p (tree decl)
return false;
if (DECL_DECLARED_CONSTEXPR_P (decl))
return true;
+ if (DECL_VALUE_EXPR (decl))
+ /* A proxy isn't constant. */
+ return false;
return (CP_TYPE_CONST_NON_VOLATILE_P (type)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (type));
}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const1.C
new file mode 100644
index 0000000..8b54578
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const1.C
@@ -0,0 +1,18 @@
+// PR c++/67411
+// { dg-do compile { target c++14 } }
+
+template <class T>
+void f()
+{
+ int i = 42;
+ [x = i] {
+ [&](auto) {
+ [=] { return x; }();
+ }(1);
+ }();
+}
+
+int main()
+{
+ f<int>();
+}