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:40:27: error: chosen constructor is explicit in copy-initialization
  unit<has_explicit_ctor> s1 = {10};  //ng
                          ^    ~~~~
prog.cc:24:22: note: explicit constructor declared here
  explicit constexpr unit(U&& other)
                     ^
prog.cc:41:27: error: no viable conversion from 'int' to 'unit<has_explicit_ctor>'
  unit<has_explicit_ctor> s2 = 10;    //ng
                          ^    ~~
prog.cc:14:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const unit<has_explicit_ctor> &' for 1st argument
struct unit {
       ^
prog.cc:14:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'unit<has_explicit_ctor> &&' for 1st argument
struct unit {
       ^
prog.cc:18:13: note: candidate template ignored: requirement 'is_convertible<int, has_explicit_ctor>::value' was not satisfied [with U = int]
  constexpr unit(U&& other)
            ^
2 errors generated.
Exit Code:
1