gcc/cp/ChangeLog:
PR c++/70204
* constexpr.c (non_const_var_error): Check
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
gcc/testsuite/ChangeLog:
PR c++/70204
* g++.dg/cpp0x/constexpr-70204a.C: New test.
* g++.dg/cpp0x/constexpr-70204b.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234390
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-03-22 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/70204
+ * constexpr.c (non_const_var_error): Check
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
+
2016-03-21 Richard Henderson <rth@redhat.com>
PR c++/70273
inform (DECL_SOURCE_LOCATION (r),
"%q#D is volatile", r);
else if (!DECL_INITIAL (r)
- || !TREE_CONSTANT (DECL_INITIAL (r)))
+ || !TREE_CONSTANT (DECL_INITIAL (r))
+ || !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (r))
inform (DECL_SOURCE_LOCATION (r),
"%qD was not initialized with a constant "
"expression", r);
+2016-03-22 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/70204
+ * g++.dg/cpp0x/constexpr-70204a.C: New test.
+ * g++.dg/cpp0x/constexpr-70204b.C: New test.
+
2016-03-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/70326
--- /dev/null
+// PR c++/70204
+// { dg-do compile { target c++11 } }
+
+int a;
+
+template < int N, int I >
+void fn1 ()
+{
+ const int x = I * a, y = x;
+ fn1 < y, I > (); // { dg-error "constant|no match" }
+}
+
+int
+main ()
+{
+ fn1 < 0, 0 > ();
+ return 0;
+}
--- /dev/null
+// PR c++/70204
+// { dg-do compile { target c++11 } }
+
+int a;
+
+void fn1 ()
+{
+ const int x = 0 * a;
+ constexpr int y = x; // { dg-error "constant" }
+}