Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

almost 4 years ago

Language

C++

Compiler

clang 11.1.0

Options
Warnings
Don't Use Boost
C++2a
no pedantic

Author

anonymous

almost 4 years ago

$ clang++ prog.cc -Wall -Wextra -std=c++2a
prog.cc:3:23: error: call to consteval function 'sqr' is not a constant expression
int x = 100; int r2 = sqr(x);  // Error: Call does not produce a constant
                      ^
prog.cc:3:27: note: read of non-const variable 'x' is not allowed in a constant expression
int x = 100; int r2 = sqr(x);  // Error: Call does not produce a constant
                          ^
prog.cc:3:5: note: declared here
int x = 100; int r2 = sqr(x);  // Error: Call does not produce a constant
    ^
1 error generated.
Exit Code:
1