Здравствуйте, niXman, Вы писали:
X>недавно в GCC ML была эта тема. кто-то таки спрашивал, почему есть что есть, а в кланге — констекспр? так разрабы ответили, что в стандарте так написано, иначе — самодеятельность. и предложили написать пропосал.
8 The function-local predefined variable __func__ is defined as if a definition of the form
static const char __func__[] = "function-name ";
И что интересно, специально сделали оговорку для эмуляции констекспра
1 If the type of a template-parameter contains a placeholder type (7.1.7.4, 14.1), the deduced parameter type is
determined from the type of the template-argument by placeholder type deduction (7.1.7.4.1). If a deduced
parameter type is not permitted for a template-parameter declaration (14.1), the program is ill-formed.
2 A template-argument for a non-type template-parameter shall be a converted constant expression (5.20) of
the type of the template-parameter. For a non-type template-parameter of reference or pointer type, the
value of the constant expression shall not refer to (or for a pointer type, shall not be the address of):
(2.1) — a subobject (1.8),
(2.2) — a temporary object (12.2),
(2.3) — a string literal (2.13.5),
(2.4) — the result of a typeid expression (5.2.8), or
(2.5) — a predefined __func__ variable (8.4.1).
Но тут следует заметить, что макросы __FUNCTION__ и __PRETTY_FUNCTION__ в стандарте отсутствуют вообще. И вот их вполне могли сделать настоящим констекспром, без отмахиваний "пишите пропозал".