Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

almost 4 years ago

Language

C++

Compiler

clang HEAD 13.0.0 (https://github.com/llvm/llvm-project.git c4ed142e695f14ba5675ec6d12226ee706329a0f)

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