But that would compile and run, and you'd still get garbage if you tried to access str later, correct?
In Swift you are not allowed to declare a variable without assigning some value or nil to it before the current scope ends.
In Swift you are not allowed to declare a variable without assigning some value or nil to it before the current scope ends.
The semantics of c++ object initialization are such that a constructor will always be called.