Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
2 // constant expressions. | 2 // constant expressions. |
3 // { dg-do compile { target c++11 } } | 3 // { dg-do compile { target c++11 } } |
4 | 4 |
5 int i; | 5 int i; |
6 | 6 |
7 // The following is accepted due to bug 49171. | 7 // The following was accepted due to bug 49171. |
8 constexpr void *q = reinterpret_cast<void*>(&i); // { dg-error "" "bug c++/49171" { xfail *-*-* } } | 8 constexpr void *q = reinterpret_cast<void*>(&i); // { dg-error "not a constant expression" } |
9 | 9 |
10 constexpr void *r0 = reinterpret_cast<void*>(1); // { dg-error "not a constant expression|reinterpret_cast from integer to pointer" } | 10 constexpr void *r0 = reinterpret_cast<void*>(1); // { dg-error "not a constant expression|reinterpret_cast from integer to pointer" } |
11 constexpr void *r1 = reinterpret_cast<void*>(sizeof 'x'); // { dg-error ".reinterpret_cast<void\\*>\\(1\[ul\]\*\\). is not a constant expression" } | 11 constexpr void *r1 = reinterpret_cast<void*>(sizeof 'x'); // { dg-error ".reinterpret_cast<void\\*>\\(1\[ul\]\*\\). is not a constant expression" } |
12 | 12 |
13 template <class T> | 13 template <class T> |
19 #else | 19 #else |
20 return *reinterpret_cast<T*>(sizeof (T)); | 20 return *reinterpret_cast<T*>(sizeof (T)); |
21 #endif | 21 #endif |
22 } | 22 } |
23 | 23 |
24 constexpr bool b = f<int>(); // { dg-error "not a constant expression" } | 24 constexpr bool b = f<int>(); // { dg-error "not a constant expression|in .constexpr. expansion of " } |