8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-static13.C
Sandra Loosemore bb97ad35ea Add -fdelete-null-pointer-checks to more new C++ testcases.
2020-02-13  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/
	* g++.dg/cpp0x/constexpr-static13.C:
	Add -fdelete-null-pointer-checks.
	* g++.dg/cpp2a/constexpr-new11.C: Likewise.
	* g++.dg/cpp2a/constexpr-new12.C: Likewise.
2020-02-13 10:47:55 -08:00

19 lines
563 B
C

// PR c++/92003
// { dg-do compile { target c++11 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// { dg-prune-output "narrowing conversion" }
constexpr char const* get_c_str() { return "abc"; }
constexpr bool use_get_c_str_in_constexpr_context{get_c_str()}; // works
template <char... Cs>
struct string {
static constexpr char const* c_str() { return c; }
private:
static constexpr char c[]{Cs..., '\0'};
};
constexpr char const* cstr{string<'a', 'b', 'c'>::c_str()};
constexpr bool use_cstr_in_constexpr_context{cstr}; // doesn't work