]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58609 ([c++11] ICE with uninitialized variable in constexpr)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 7 Mar 2014 18:33:38 +0000 (18:33 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 7 Mar 2014 18:33:38 +0000 (18:33 +0000)
/cp
2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58609
* decl.c (check_initializer): Return NULL_TREE after error;
consistently use inform.

/testsuite
2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58609
* g++.dg/cpp0x/constexpr-ice12.C: New.

From-SVN: r208410

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-ice12.C [new file with mode: 0644]

index 3c288c09efa5103e428d09ab51eb50398aa4c06b..fd0b4d2e240ec33ce6526c2bfb50a1e1600d55e8 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58609
+       * decl.c (check_initializer): Return NULL_TREE after error;
+       consistently use inform.
+
 2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * decl.c (check_initializer): Remove dead code.
index cd2cc9cfdd70b44e8c77d62fb650a16691e006aa..389ed1a9890d22b026b488e1648b5aecf390e35e 100644 (file)
@@ -5809,9 +5809,11 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
               "member %qD", decl);
       if (!explained)
        {
-         error ("(an out of class initialization is required)");
+         inform (input_location,
+                 "(an out of class initialization is required)");
          explained = 1;
        }
+      return NULL_TREE;
     }
 
   return init_code;
index 642abab5f2a4b8d3f828ac22481c183651ed1e37..f516a7554d12384c219a7c8ea2643c4c2d28edb8 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58609
+       * g++.dg/cpp0x/constexpr-ice12.C: New.
+
 2014-03-07  Thomas Schwinge  <thomas@codesourcery.com>
 
        * c-c++-common/gomp/map-1.c: Extend.
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice12.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice12.C
new file mode 100644 (file)
index 0000000..98f53b1
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/58609
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  static constexpr int&& i = 0;  // { dg-error "initialization" }
+};
+
+int j = A::i;