Language
C++
Compiler
gcc HEAD 15.0.1 20250305 (experimental)
Options
Don't Use Boost
C++2b(GNU)
no pedantic
$ g++ prog.cc -std=gnu++2b
Exit Code:
1
C++
gcc HEAD 15.0.1 20250305 (experimental)
$ g++ prog.cc -std=gnu++2b
prog.cc: In instantiation of 'void swap(T, T2) [with T = double; T2 = char]':
prog.cc:14:9: required from here
14 | swap(d, ch); //Compilation Error
| ~~~~^~~~~~~
prog.cc:6:31: error: static assertion failed: overflow
6 | static_assert((sizeof(T2) > sizeof(T)), "overflow");
| ~~~~~~~~~~~~^~~~~~~~~~~~
prog.cc:6:31: note: the comparison reduces to '(1 > 8)'