Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 3 years ago

Language

C++

Compiler

gcc 11.1.0

Options
Warnings
Boost 1.79.0
C++2b(GNU)
no pedantic

Author

anonymous

about 3 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.79.0-gcc-11.1.0/include -std=gnu++2b
prog.cc: In function 'constexpr int f()':
prog.cc:1:52: error: the value of 't' is not usable in a constant expression
    1 | constexpr int f() { int t = 10; constexpr int t2 = t;  return t2; };
      |                                                    ^
prog.cc:1:25: note: 'int t' is not const
    1 | constexpr int f() { int t = 10; constexpr int t2 = t;  return t2; };
      |                         ^
prog.cc: In function 'int main()':
prog.cc:5:19: warning: unused variable 'z' [-Wunused-variable]
    5 |     constexpr int z = f();
      |                   ^
Exit Code:
1