| 1 |
// PR c++/92003 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options "-fdelete-null-pointer-checks" } |
| 4 |
// { dg-prune-output "narrowing conversion" } |
| 5 |
|
| 6 |
constexpr char const* get_c_str() { return "abc"; } |
| 7 |
constexpr bool use_get_c_str_in_constexpr_context{get_c_str()}; // works |
| 8 |
|
| 9 |
template <char... Cs> |
| 10 |
struct string { |
| 11 |
static constexpr char const* c_str() { return c; } |
| 12 |
|
| 13 |
private: |
| 14 |
static constexpr char c[]{Cs..., '\0'}; |
| 15 |
}; |
| 16 |
|
| 17 |
constexpr char const* cstr{string<'a', 'b', 'c'>::c_str()}; |
| 18 |
constexpr bool use_cstr_in_constexpr_context{cstr}; // doesn't work |