aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-22 23:46:44 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-22 23:46:44 -0400
commit2701664a0266af935d5fea7c5586a5686fe32365 (patch)
treeff9f692ff5d1df3031ada35da63437dc453d453e
parentcfb00b41d986cfe48ff0d06722f64122b8f1a41e (diff)
downloadgcc-2701664a0266af935d5fea7c5586a5686fe32365.zip
gcc-2701664a0266af935d5fea7c5586a5686fe32365.tar.gz
gcc-2701664a0266af935d5fea7c5586a5686fe32365.tar.bz2
re PR c++/56915 (ICE in symtab_add_to_same_comdat_group, at symtab.c:383)
PR c++/56915 * semantics.c (maybe_add_lambda_conv_op): Give up if the call op isn't defined. From-SVN: r199231
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template11.C25
3 files changed, 38 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f665312..cd58d70 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/56915
+ * semantics.c (maybe_add_lambda_conv_op): Give up if the call op
+ isn't defined.
+
2013-05-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57352
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 92a4917..5b36337 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -9784,6 +9784,13 @@ maybe_add_lambda_conv_op (tree type)
if (processing_template_decl)
return;
+ if (DECL_INITIAL (callop) == NULL_TREE)
+ {
+ /* If the op() wasn't instantiated due to errors, give up. */
+ gcc_assert (errorcount || sorrycount);
+ return;
+ }
+
stattype = build_function_type (TREE_TYPE (TREE_TYPE (callop)),
FUNCTION_ARG_CHAIN (callop));
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template11.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template11.C
new file mode 100644
index 0000000..520b804
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template11.C
@@ -0,0 +1,25 @@
+// PR c++/56915
+// { dg-require-effective-target c++11 }
+
+template <typename T>
+class A
+{
+ typename T::type b(); // { dg-error "int" }
+};
+
+template <typename T, typename U>
+void waldo(T, U) {}
+
+template <typename T>
+void bar()
+{
+ waldo([](A<T> a){ return a; },
+ []{});
+}
+
+int main()
+{
+ bar<int>();
+}
+
+// { dg-prune-output "used but never defined" }