Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 3 years ago

Language

C++

Compiler

clang 12.0.1

Options
Warnings
Boost 1.78.0
C++2b(GNU)
-pedantic
Raw compiler options
-Wconversion

Author

anonymous

about 3 years ago

$ clang++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.78.0-clang-12.0.1/include -std=gnu++2b -pedantic -Wconversion
prog.cc:2:40: warning: variable 't' is uninitialized when used here [-Wuninitialized]
constexpr T f() { T t/* = 10*/; return t; };
                                       ^
prog.cc:6:23: note: in instantiation of function template specialization 'f<int>' requested here
    constexpr int z = f<int>(); // error
                      ^
prog.cc:2:22: note: initialize the variable 't' to silence this warning
constexpr T f() { T t/* = 10*/; return t; };
                     ^
                      = 0
prog.cc:6:19: error: constexpr variable 'z' must be initialized by a constant expression
    constexpr int z = f<int>(); // error
                  ^   ~~~~~~~~
prog.cc:2:40: note: read of uninitialized object is not allowed in a constant expression
constexpr T f() { T t/* = 10*/; return t; };
                                       ^
prog.cc:6:23: note: in call to 'f()'
    constexpr int z = f<int>(); // error
                      ^
1 warning and 1 error generated.
Exit Code:
1