* constexpr.c (literal_type_p): Return true for void type in C++14.
* g++.dg/cpp0x/constexpr-function2.C: Limit dg-error to C++11.
* g++.dg/cpp0x/constexpr-neg1.C: Likewise.
* g++.dg/cpp1y/constexpr-void1.C: New test.
From-SVN: r218220
+2014-12-01 Marek Polacek <polacek@redhat.com>
+
+ * constexpr.c (literal_type_p): Return true for void type in C++14.
+
2014-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60845
{
if (SCALAR_TYPE_P (t)
|| TREE_CODE (t) == VECTOR_TYPE
- || TREE_CODE (t) == REFERENCE_TYPE)
+ || TREE_CODE (t) == REFERENCE_TYPE
+ || (VOID_TYPE_P (t) && cxx_dialect >= cxx14))
return true;
if (CLASS_TYPE_P (t))
{
+2014-12-01 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp0x/constexpr-function2.C: Limit dg-error to C++11.
+ * g++.dg/cpp0x/constexpr-neg1.C: Likewise.
+ * g++.dg/cpp1y/constexpr-void1.C: New test.
+
2014-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60845
int next(constexpr int x) // { dg-error "parameter" }
{ return x + 1; }
-constexpr void f(int x) // { dg-error "return type .void" }
+constexpr void f(int x) // { dg-error "return type .void" "" { target c++11_only } }
{ /* ... */ }
constexpr int prev(int x)
extern constexpr int memsz; // { dg-error "definition" }
// error: return type is void
-constexpr void f(int x) // { dg-error "void" }
+constexpr void f(int x) // { dg-error "void" "" { target c++11_only } }
{ /* ... */ }
// error: use of decrement
constexpr int prev(int x)
--- /dev/null
+// { dg-do compile { target c++14 } }
+
+struct S
+{
+ int i = 20;
+
+ constexpr void
+ foo (void)
+ {
+ if (i > 20)
+ __builtin_abort ();
+ }
+};