[Bug c++/71457] New: valid pointer plus conversion to bool rejected in constexpr context
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 8 15:48:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71457
Bug ID: 71457
Summary: valid pointer plus conversion to bool rejected in
constexpr context
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
GCC rejects both of the following valid constant expressions (Clang accepts
both):
$ cat zzz.c && /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B
/home/msebor/build/gcc-trunk-svn/gcc -Wall -Wextra -Wpedantic -xc++ zzz.c
constexpr bool f ()
{
int i = 1;
return &i + 1;
}
constexpr bool b0 = f ();
constexpr bool b1 = "abc" + 1;
zzz.c:4:15: error: ‘(((& i) + 4u) != 0u)’ is not a constant expression
return &i + 1;
^
zzz.c:9:29: error: ‘((((const char*)"abc") + 1u) != 0u)’ is not a constant
expression
constexpr bool b1 = "abc" + 1;
^
More information about the Gcc-bugs
mailing list