This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71457] New: valid pointer plus conversion to bool rejected in constexpr context
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Jun 2016 15:48:47 +0000
- Subject: [Bug c++/71457] New: valid pointer plus conversion to bool rejected in constexpr context
- Auto-submitted: auto-generated
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;
^