Created
August 8, 2014 10:15
-
-
Save ecatmur/7f0487c219b473c5b3fa to your computer and use it in GitHub Desktop.
Contextual implicit conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/rvbQiAx38Tg%5B1-25-false%5D | |
# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf | |
struct C1 { enum class A{}; operator A(); explicit operator unsigned(); } c1; | |
struct C2 { operator char*(); explicit operator bool(); } c2; | |
struct C3 { operator int() = delete; operator unsigned(); } c3; | |
struct C4 { explicit operator int() = delete; operator unsigned(); } c4; | |
struct C5 { operator int(); explicit operator unsigned(); } c5; | |
void f() { | |
switch (c1) {} | |
switch (c2) {} | |
switch (c3) {} | |
switch (c4) {} | |
switch (c5) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment