aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-08-17 21:06:49 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-08-17 21:06:49 -0400
commit34fdd6b31e8b715b2dfb1490b7c77b4eddacc8df (patch)
tree55f2774f9a93daf2247bc5f51587bb5fb38bb0f8 /gcc
parentd709431600b4c790e51d838bd71f38a3acda8eba (diff)
downloadgcc-34fdd6b31e8b715b2dfb1490b7c77b4eddacc8df.zip
gcc-34fdd6b31e8b715b2dfb1490b7c77b4eddacc8df.tar.gz
gcc-34fdd6b31e8b715b2dfb1490b7c77b4eddacc8df.tar.bz2
re PR c++/58083 (ICE with lambda as default parameter of a template function)
PR c++/58083 * name-lookup.c (push_class_level_binding_1): It's OK to push a lambda type after the enclosing type is complete. From-SVN: r201822
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C30
3 files changed, 40 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7ada1ae..71dcfb8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/58083
+ * name-lookup.c (push_class_level_binding_1): It's OK to push a
+ lambda type after the enclosing type is complete.
+
2013-08-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (dump_scope): Add a cxx_pretty_printer parameter.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 0fe0246..cf6c757 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3062,8 +3062,10 @@ push_class_level_binding_1 (tree name, tree x)
if (name == error_mark_node)
return false;
- /* Check for invalid member names. */
- gcc_assert (TYPE_BEING_DEFINED (current_class_type));
+ /* Check for invalid member names. But don't worry about a default
+ argument-scope lambda being pushed after the class is complete. */
+ gcc_assert (TYPE_BEING_DEFINED (current_class_type)
+ || LAMBDA_TYPE_P (TREE_TYPE (decl)));
/* Check that we're pushing into the right binding level. */
gcc_assert (current_class_type == class_binding_level->this_entity);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C
new file mode 100644
index 0000000..d85918d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C
@@ -0,0 +1,30 @@
+// PR c++/58083
+// { dg-do compile { target c++11 } }
+
+namespace details {
+struct iterator_concept_checker
+{
+ typedef char yes_type;
+ typedef char (&no_type)[2];
+
+ template <typename T>
+ static no_type test(...);
+
+ template <typename T>
+ static yes_type test(
+ int*
+ , void (*)(T) = [](T it)
+ {
+ auto copy = T{it}; // copy constructible
+ copy = it; // copy assignable
+ copy.~T(); // destroyable
+ ++it; // incrementable
+ }
+ );
+};
+}
+
+int main()
+{
+ details::iterator_concept_checker::test<int>(0);
+}