Returning in C++14 constexpr constructor leads to ICE

Asked by Valentin Ochs on 2017-08-12

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 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.



Question information

English Edit question
GNU Arm Embedded Toolchain Edit question
No assignee Edit question
Last query:
Last reply:
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.

Thomas Preud'homme (robotux) said : #2

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

Valentin Ochs (cation) said : #3

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

Valentin Ochs (cation) said : #4

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

Launchpad Janitor (janitor) said : #6

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