Comment on web page https://gcc.gnu.org/projects/cxx-status.html#cxx11

Dr. Jürgen Sauermann mail@juergen-sauermann.de
Sat Dec 4 10:32:34 GMT 2021


On 12/3/21 9:12 PM, Jonathan Wakely wrote:
>
>
> On Fri, 3 Dec 2021, 18:58 Dr. Jürgen Sauermann, 
> <mail@juergen-sauermann.de <mailto:mail@juergen-sauermann.de>> wrote:
>
>     Hi,
>
>     not sure if this matters or how int can be fixed, but today I
>     observed
>     the following:
>
>     Your web page says that "Static assertions" are supported by GCC
>     since
>     version 4.3.
>
>     Today I tried to use "Static assertions" on an  avr-g++ resp. avr-gcc
>     which identifies
>     itself as:
>
>     eedjsa@server68:~/projects/AVR_workspace/ATMEGA8U2_32U2$ avr-g++
>     --version
>     avr-g++ (GCC) 5.4.0
>     Copyright (C) 2015 Free Software Foundation, Inc.
>     This is free software; see the source for copying conditions. 
>     There is NO
>     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>     PURPOSE.
>
>     eedjsa@server68:~/projects/AVR_workspace/ATMEGA8U2_32U2$ avr-gcc
>     --version
>     avr-gcc (GCC) 5.4.0
>     Copyright (C) 2015 Free Software Foundation, Inc.
>     This is free software; see the source for copying conditions. 
>     There is NO
>     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>     PURPOSE.
>
>     but it seems not to support static assertions.
>
>     The "regular" g++ works:
>
>     eedjsa@server68:~/projects/AVR_workspace/ATMEGA8U2_32U2$ echo '
>     static_assert(0, "error"); int main() {}' | g++ -S -o /dev/null -x
>     c++ -
>     <stdin>:2:15: error: static assertion failed: error
>
>     while the avr-g++ fails:
>
>     eedjsa@server68:~/projects/AVR_workspace/ATMEGA8U2_32U2$ echo '
>     static_assert(0, "error"); int main() {}' | avr-g++ -S -o
>     /dev/null -x c++ -
>     <stdin>:2:14: error: expected constructor, destructor, or type
>     conversion before ‘(’ token
>
>     Maybe this should be mentioned on the web page.
>
>
>
> Static assertions are a C++11 feature, so you simply need to use 
> -std=c++11 or -std=gnu++11
>
>
Hi Jonathan,

thanks a lot. This works indeed, even with avr-gcc/g++.






More information about the Gcc mailing list