Commit 8ac43293 by Martin Sebor Committed by Martin Sebor

PR c++/66639 - declare __func__ , __FUNCTION__ & __PRETTY_FUNCTION__ constexpr

PR c++/66639 - declare __func__ , __FUNCTION__ & __PRETTY_FUNCTION__ constexpr
* g++.dg/cpp1y/func_constexpr.C: New test.

From-SVN: r235458
parent 843ce8ab
2016-04-26 Martin Sebor <msebor@redhat.com>
PR c++/66639
* g++.dg/cpp1y/func_constexpr.C: New test.
2016-04-26 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70241
......
// PR c++/66639 - declare __func__ , __FUNCTION__ & __PRETTY_FUNCTION__
// as constexpr
// { dg-do compile { target c++11 } }
#define Assert(expr) static_assert ((expr), #expr)
#define Compare(a, b) Assert (0 == __builtin_strcmp (a, b))
constexpr const char* func ()
{
return __func__;
}
constexpr const char* function ()
{
return __FUNCTION__;
}
constexpr const char* pretty_function ()
{
return __PRETTY_FUNCTION__;
}
constexpr const char* f0 = func ();
constexpr const char* f1 = function ();
constexpr const char* f2 = pretty_function ();
Compare (f0, "func");
Compare (f1, "function");
Compare (f2, "constexpr const char* pretty_function()");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment