Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

almost 7 years ago

Language

C++

Compiler

clang HEAD 9.0.0 (https://github.com/llvm-mirror/clang.git fd40bdf2995aef31cc236544c00aa41b3b7e04d9) (https://github.com/llvm-mirror/llvm.git 594d5b198e4b881dae6cc99c997ac3c87fd54fb9)

Options
Warnings
Boost 1.70.0
C++2a(GNU)
no pedantic

Author

anonymous

almost 7 years ago

$ clang++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.70.0/clang-head/include -std=gnu++2a
prog.cc:23:21: error: chosen constructor is explicit in copy-initialization
  has_explicit_ctor s2 = {2};  //ng
                    ^    ~~~
prog.cc:18:12: note: explicit constructor declared here
  explicit has_explicit_ctor(int) {}
           ^
prog.cc:24:21: error: no viable conversion from 'int' to 'has_explicit_ctor'
  has_explicit_ctor s3 = 3;    //ng
                    ^    ~
prog.cc:17:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const has_explicit_ctor &' for 1st argument
struct has_explicit_ctor {
       ^
prog.cc:17:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'has_explicit_ctor &&' for 1st argument
struct has_explicit_ctor {
       ^
2 errors generated.
Exit Code:
1