4 ms·
You're correct that initialization is not assignment, but the assignment section is still the relevant place to look: the initialization section says "the same
by hvdijk 6y ago
You're correct that initialization is not assignment, but the assignment section is still the relevant place to look: the initialization section says "the same type constraints and conversions as for simple assignment apply". But that isn't obvious and I should have spelled that out.
- NovemberWhiskey 6y agoBut that's in the semantics section; not the constraints section; right?
- hvdijk 6y agoHeh, true. It's pretty clearly meant to mean that the constraints for simple assignment apply as constraints for initialization too, but if you were to argue that the constraints of simple assignment are imported as semantics for initialization, and therefore violations render the behaviour undefined (not requiring any diagnostic), I wouldn't be able to point to anything that shows that to be wrong other than common sense, and common sense can be wrong. The same applies to the return statement, which says "is converted as if by assignment" outside of its "Constraints" section as well.