Returning in C++14 constexpr constructor leads to ICE

Asked by Valentin Ochs

Trying to compile a class with a constexpr constructor that returns at any point like in [1] leads to the error

    foo.cpp:8:3: in constexpr expansion of 'mwi.A::A()'
    foo.cpp:8:3: internal compiler error: in cxx_eval_constant_expression, at cp/constexpr.c:4201
     A mwi;
       ^~~

On godbolt.org I can see that it works for ARM64-gcc and x86_64-gcc, but not ARM-gcc, so it's not just on my box.

Should I file a bug report?

Some data:
Release 6-2017-q2-update, binary package, x86-64 host.

Cheers,
Valentin

[1] https://p.0au.de/b086020b/foo.cpp

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (robotux) said :
#1

Confirmed when using just arm-none-eabi-gcc -c. Adding -std=c11 on the command-line gives an error instead. Were the x86 and Aarch64 GCC compiler you used in your test also GCC 6?

Best regards.

Revision history for this message
Thomas Preud'homme (robotux) said :
#2

I can reproduce with trunk GCC by adding -std=c++14 on the command-line.

Revision history for this message
Valentin Ochs (cation) said :
#3

That's curious, with GCC 6.3.0 on goldbolt.org it works with x64 and arm64, and on a local (x64) gcc 7.1.0 it also works.

Revision history for this message
Valentin Ochs (cation) said :
#4

That is: Yes, the x86 and aarch64 compilers were also gcc 6. :)

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#5
Revision history for this message
Launchpad Janitor (janitor) said :
#6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.