[llvm-bugs] [Bug 26927] New: constexpr __FUNCTION__, __func__, and __PRETTY_FUNCTION__
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 12 14:19:33 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26927
Bug ID: 26927
Summary: constexpr __FUNCTION__, __func__, and
__PRETTY_FUNCTION__
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: djeedai at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Being able to use __FILE__ and __LINE__ to initialize constexpr variables is
already supported, and a valuable feature. However the non-standard
__FUNCTION__, __func__, and __PRETTY_FUNCTION__ don't seem to be declared in
such a way that would allow them to do so:
void func()
{
constexpr static const char this_file[] { __FILE__ }; // OK
constexpr static const int this_line = __LINE__; // OK
constexpr static const char this_func[] { __PRETTY_FUNCTION__ }; // compiler
error: not a constant expression
}
MSVC allows this with __FUNCSIG__. It seems there's no plan to add this for GCC
though: https://gcc.gnu.org/ml/gcc-bugs/2015-06/msg02292.html
This is somewhat related to #20013, although #20013 is just one possible way to
fix this.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160312/749ae5e6/attachment.html>
More information about the llvm-bugs
mailing list