So I can't reproduce this via godbolt
For example both the example given and:
classX {
private:
staticconstexprintx = 5;
staticconstexprinty = 4;
public:
structalignas(y) S {
chardata[x];
};
}; BOTH give errors for me - I'm just going to leave it at this point.
It's obviously fixed whatever it was. Thanks for your time. Alec
On 09/01/18 14:26, Mason wrote:
On 09/01/2018 14:39, Alec Teal wrote:
In GCC 4.8.4 I have something like the following:
FWIW, 4.8 is no longer supported (2013)
constexpr int x = 5;
constexpr int y = 4;
struct alignas(y) my_data_block {
char data[x];
};
And it causes some weird errors to the tune of "size of array 'data' is
not an integral constant-expression" in the presence of the alignas
A good support request should specify
- exact compiler version (GCC 4.8.4)
- a small testcase (given above)
- exact compilation flags (missing)
- exact error message
Compiling the above source on godbolt using:
gcc 4.8.4 -Wall -Wextra
1 : <source>:1:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat]
constexpr int x = 5;
^
1 : <source>:1:1: error: 'constexpr' does not name a type
1 : <source>:1:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
2 : <source>:2:1: error: 'constexpr' does not name a type
constexpr int y = 4;
^
2 : <source>:2:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
3 : <source>:3:19: error: expected initializer before 'my_data_block'
struct alignas(y) my_data_block {
^
Compiler returned: 1
Compiling the above source on godbolt using:
gcc 4.8.4 -Wall -Wextra -std=c++11
No errors.
So it seems I can't reproduce the issue?
Looking at Bugzilla as jwakely suggested turns up
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58601
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124
Regards.