I came across some code like the following in one the CppCon 2014 talks that confused the heck out of me. The audience accepted it without comment, so I presume that it's legal:
enum class Foo { Bar };
Foo const v1 = Foo(5);
The question is: why does this compile? I would expect compilation to fail and complain that we can't convert an int to a Foo. The slightly modified line below fails with the expected error:
Foo const v1(5);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With