[Bug c++/97580] New: reinterpret_cast<> and constant expression
wolfgang.roehrl@gi-de.com
gcc-bugzilla@gcc.gnu.org
Mon Oct 26 13:08:05 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97580
Bug ID: 97580
Summary: reinterpret_cast<> and constant expression
Product: gcc
Version: 7.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wolfgang.roehrl@gi-de.com
Target Milestone: ---
Hi,
I would like to post a bug report for the GNU C/C++ compiler 7.5.0.
We use the compiler to generate code for a PowerPC processor.
Invokation line for the GNU C++ compiler:
ccppc -c -x c++ --std=gnu++17 -Wall -Werror -g -mcpu=e6500 -m32
-maltivec -mvrsave -ftls-model=local-exec -msdata=sysv
-fno-common -fno-openmp -mbig -mmultiple -mno-string -misel
-mstrict-align -fverbose-asm -G 8 -O3
-I<some include paths>
-D<some #define's>
X.CPP -oX.O
// file X.CPP
using T_PTR_FUNC = void (*)(int*);
void func1 (int*);
void func2 (float*);
constexpr T_PTR_FUNC arrFuncs[] =
{ func1, reinterpret_cast<T_PTR_FUNC>(func2) };
The compiler accepts this code even though a reinterpret_cast<> fails to be
a constant expression (cf. C++17 standard, 8.20/2).
With kind regards
W. Roehrl
More information about the Gcc-bugs
mailing list