]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/58568 ([c++11] ICE with lambda in invalid template variable definition)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 8 Oct 2013 21:58:58 +0000 (21:58 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 8 Oct 2013 21:58:58 +0000 (21:58 +0000)
/cp
2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58568
* lambda.c (begin_lambda_type): Check return value of xref_tag
for error_mark_node; tidy.
* decl.c (grokdeclarator): Tweak error message.

/testsuite
2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58568
* g++.dg/cpp0x/lambda/lambda-ice10.C: New.
* g++.old-deja/g++.mike/misc9.C: Adjust.

From-SVN: r203289

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/lambda.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.mike/misc9.C

index 3e68712c2a4a651714e5eec3b5adf558ff33eb63..70dab1eeaecac44402efbb6c357bf9d9302c6784 100644 (file)
@@ -1,3 +1,10 @@
+2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58568
+       * lambda.c (begin_lambda_type): Check return value of xref_tag
+       for error_mark_node; tidy.
+       * decl.c (grokdeclarator): Tweak error message.
+
 2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58665
index 81ed409b963e278cad7762d0030c7fa062c46b56..5f17a056079b45ea2726bf2386f66d0df3f3da2a 100644 (file)
@@ -8774,8 +8774,8 @@ grokdeclarator (const cp_declarator *declarator,
                             && !uniquely_derived_from_p (ctype,
                                                          current_class_type))
                      {
-                       error ("type %qT is not derived from type %qT",
-                              ctype, current_class_type);
+                       error ("invalid use of qualified-name %<%T::%D%>",
+                              qualifying_scope, decl);
                        return error_mark_node;
                      }
                  }
index 2ffa7e01d786990d034110ac2547cfe167ae262e..2ecb17cfe916220b15f201c5d8982ec218edaae2 100644 (file)
@@ -138,6 +138,8 @@ begin_lambda_type (tree lambda)
                      name,
                      /*scope=*/ts_lambda,
                      /*template_header_p=*/false);
+    if (type == error_mark_node)
+      return error_mark_node;
   }
 
   /* Designate it as a struct so that we can use aggregate initialization.  */
@@ -152,8 +154,6 @@ begin_lambda_type (tree lambda)
 
   /* Start the class.  */
   type = begin_class_definition (type);
-  if (type == error_mark_node)
-    return error_mark_node;
 
   return type;
 }
index a45b913080a1e53b413e6d061779af5658d9e3b9..fde103b9e55789b429c76b5b8bd5b7eebefb9f98 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58568
+       * g++.dg/cpp0x/lambda/lambda-ice10.C: New.
+       * g++.old-deja/g++.mike/misc9.C: Adjust.
+
 2013-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58665
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C
new file mode 100644 (file)
index 0000000..1ea59c2
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/58568
+// { dg-do compile { target c++11 } }
+
+template<int> struct A
+{
+  static const int i;
+  template<int N> const int A<N>::i = []{ return 0; }(); // { dg-error "invalid use" }
+};
index 3d8858cf64a248a348d6552bac5d2e4d7c7b9462..7b9a86cbf4a3fe58a6a4ac3270c5af2523a8584c 100644 (file)
@@ -8,6 +8,6 @@ class bee {
 
 class foo {
  public:
-  int bee::bar;                // { dg-error "not derived" } you cannot do this
+  int bee::bar;                // { dg-error "invalid use" } you cannot do this
     int me();
 };
This page took 0.108366 seconds and 5 git commands to generate.