constexpr struct/class instantiation not working

Bug #1836302 reported by Toni Neubert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Fix Released
Undecided
Unassigned

Bug Description

The following code snipped does not compile under ARM gcc 8.x (also arm-none-eabi):

```
constexpr int bar{1};

struct Foo {
 int value{bar};
};

constexpr Foo f;

constexpr Foo f2{}; // Error occurs here.
```

Fails to compile with: 'const Foo{((int)bar)}' is not a constant expression

Check out: https://godbolt.org/z/JGKfNk

It works in ARM gcc 7.x and all x86-64 clang/gcc version.

Revision history for this message
Toni Neubert (viatorus) wrote :

Solved in GCC 8.2019.3+Update. Thank you! :)

Revision history for this message
Toni Neubert (viatorus) wrote :

GCC 8.2019.3+Update

Changed in gcc-arm-embedded:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.