https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70353

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|static_assert + assert +    |[5/6 regression] ICE on
                   |c++14 crashes GCC           |__PRETTY_FUNCTION__ in a
                   |                            |constexpr function

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 4.9 doesn't crash on the code so technically this could be considered a
regression.  Although 4.9 doesn't support C++ 14 constexpr functions consisting
of more than just a return statement, one might say it's not regression.  But
the 5.x and 5.0 both ICE even on the test C++ 11 case below, so I think
considering this a regression would be appropriate.  I've taken the liberty to
do that and also to adjust the Summary to better reflect the root cause of the
ICE.

$ cat v.c && /home/msebor/build/gcc-4.9.3/gcc/xgcc
-B/home/msebor/build/gcc-4.9.3/gcc -S -Wall -Wextra -Wpedantic -std=c++14 -xc++
v.c
constexpr int f () {
    return __PRETTY_FUNCTION__ [0];
}

constexpr int i = f ();
v.c: In function ‘constexpr int f()’:
v.c:3:1: error: body of constexpr function ‘constexpr int f()’ not a
return-statement
 }
 ^
v.c: At global scope:
v.c:5:22: error: ‘constexpr int f()’ called in a constant expression
 constexpr int i = f ();
                      ^

Reply via email to