Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Language

C++

Compiler

clang HEAD 12.0.0 (https://github.com/llvm/llvm-project.git 9087209314caafed4b232d4a66287f2d16054ad3)

Options
Warnings
Boost 1.73.0
C++2a
no pedantic

$ clang++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/clang-head/include -std=c++2a
prog.cc:11:21: error: type 'double' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing]
    int ai[] = { 1, d1 };    // warning C4838
                    ^~
prog.cc:11:21: note: insert an explicit cast to silence this issue
    int ai[] = { 1, d1 };    // warning C4838
                    ^~
                    static_cast<int>( )
prog.cc:13:14: error: type 'double' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing]
    S1 s12 { d1, 2, 3 };     // warning C4838
             ^~
prog.cc:13:14: note: insert an explicit cast to silence this issue
    S1 s12 { d1, 2, 3 };     // warning C4838
             ^~
             static_cast<int>( )
prog.cc:10:12: warning: unused variable 'ad' [-Wunused-variable]
    double ad[] = { 1, d1 }; // OK
           ^
prog.cc:11:9: warning: unused variable 'ai' [-Wunused-variable]
    int ai[] = { 1, d1 };    // warning C4838
        ^
prog.cc:12:8: warning: unused variable 's11' [-Wunused-variable]
    S1 s11 = { 1, 2, d1 };   // OK
       ^
prog.cc:13:8: warning: unused variable 's12' [-Wunused-variable]
    S1 s12 { d1, 2, 3 };     // warning C4838
       ^
prog.cc:14:8: warning: unused variable 's13' [-Wunused-variable]
    S1 s13 { static_cast<int>(d1), 2, 3 }; // possible fix for C4838
       ^
5 warnings and 2 errors generated.
Exit Code:
1