https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108965

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Christopher Friedt from comment #8)
> My code is clearly valid C++ according to g++ :-)

Maybe you mean clang++ but even then, no it's not:


$ clang++ -pedantic gen.cc
gen.cc:15:32: warning: '_Generic' is a C11 extension [-Wc11-extensions]
    printf("cbrt(8.0) = %f\n", cbrt(x)); // selects the default cbrt
                               ^
gen.cc:5:17: note: expanded from macro 'cbrt'
#define cbrt(X) _Generic((X), \
                ^
gen.cc:16:35: warning: '_Generic' is a C11 extension [-Wc11-extensions]
    printf("cbrtf(3.375) = %f\n", cbrt(y)); // converts const float to float,
                                  ^
gen.cc:5:17: note: expanded from macro 'cbrt'
#define cbrt(X) _Generic((X), \
                ^
2 warnings generated.


It's a non-standard extension, not valid C++.

Reply via email to