Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/constexpr-static13.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // PR c++/92003 | |
2 // { dg-do compile { target c++11 } } | |
3 // { dg-prune-output "narrowing conversion" } | |
4 | |
5 constexpr char const* get_c_str() { return "abc"; } | |
6 constexpr bool use_get_c_str_in_constexpr_context{get_c_str()}; // works | |
7 | |
8 template <char... Cs> | |
9 struct string { | |
10 static constexpr char const* c_str() { return c; } | |
11 | |
12 private: | |
13 static constexpr char c[]{Cs..., '\0'}; | |
14 }; | |
15 | |
16 constexpr char const* cstr{string<'a', 'b', 'c'>::c_str()}; | |
17 constexpr bool use_cstr_in_constexpr_context{cstr}; // doesn't work |