* C++ PATCH for c++/61402
@ 2014-12-12 16:43 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2014-12-12 16:43 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 155 bytes --]
This patch fixes the ICE in 61402, though I'll leave it open for the
unsequenced execution warning issue.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 61402.patch --]
[-- Type: text/x-patch, Size: 1315 bytes --]
commit 05beed857dc4e01061a38b764c26f1ff857788dd
Author: Jason Merrill <jason@redhat.com>
Date: Fri Dec 12 10:43:59 2014 -0500
PR c++/61402
* lambda.c (add_capture): Don't pass a dependent type to
variably_modified_type_p.
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 9eb9200..3da28e5 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -483,7 +483,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
NULL_TREE, array_type_nelts (type));
type = vla_capture_type (type);
}
- else if (variably_modified_type_p (type, NULL_TREE))
+ else if (!dependent_type_p (type)
+ && variably_modified_type_p (type, NULL_TREE))
{
error ("capture of variable-size type %qT that is not an N3639 array "
"of runtime bound", type);
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C
new file mode 100644
index 0000000..f7525d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C
@@ -0,0 +1,20 @@
+// PR c++/61402
+// { dg-do run { target c++14 } }
+
+extern "C" void abort();
+
+template<typename T>
+void foo(T t) {
+ auto test = [ i = ++t ](T v) {
+ if (i != v)
+ abort();
+ };
+ test(t);
+}
+
+int main(){
+ foo(3.14f);
+ foo(0);
+ foo('a');
+ foo(false);
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-12 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-12 16:43 C++ PATCH for c++/61402 Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).