annotate gcc/testsuite/g++.dg/cpp1y/func_constexpr.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/66639 - declare __func__ , __FUNCTION__ & __PRETTY_FUNCTION__
kono
parents:
diff changeset
2 // as constexpr
kono
parents:
diff changeset
3 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #define Assert(expr) static_assert ((expr), #expr)
kono
parents:
diff changeset
6 #define Compare(a, b) Assert (0 == __builtin_strcmp (a, b))
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 constexpr const char* func ()
kono
parents:
diff changeset
9 {
kono
parents:
diff changeset
10 return __func__;
kono
parents:
diff changeset
11 }
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 constexpr const char* function ()
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 return __FUNCTION__;
kono
parents:
diff changeset
16 }
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 constexpr const char* pretty_function ()
kono
parents:
diff changeset
19 {
kono
parents:
diff changeset
20 return __PRETTY_FUNCTION__;
kono
parents:
diff changeset
21 }
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 constexpr const char* f0 = func ();
kono
parents:
diff changeset
24 constexpr const char* f1 = function ();
kono
parents:
diff changeset
25 constexpr const char* f2 = pretty_function ();
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 Compare (f0, "func");
kono
parents:
diff changeset
28 Compare (f1, "function");
kono
parents:
diff changeset
29 Compare (f2, "constexpr const char* pretty_function()");