DEV Community

Discussion on: Enabling structured binding for std::complex (and custom non-POD types)

Collapse
 
pauljlucas profile image
Paul J. Lucas

Your if constexpr needs the else otherwise the second return is always there. In this case, it's harmless, but it compiles in unreachable code that the compiler may warn about. The point of if constexpr is to not compile code on either the if or else.

Collapse
 
maniowy profile image
panmanio

You're correct, thank you for catching it, it's fixed now. I was mislead by the fact that I am returning there, which would be OK for a normal if, but yes, there should be an else in order not to compile that part of code that does not go into the true branch.