Replies: 3 comments 1 reply
-
In this case cppfront generates code that produces a runtime error, so to get the code to compile and run, change this line: p = new<int>; to: p = new<int>(1); // Or some value And then you'll get a runtime "Contract violation" when trying to access |
Beta Was this translation helpful? Give feedback.
-
This is a bug in cppfront, because initialization should not be allowed in a loop (the break shouldn't affect that). Thanks for pointing this out! |
Beta Was this translation helpful? Give feedback.
-
Moved to bug #1133 |
Beta Was this translation helpful? Give feedback.
-
Due to the break, p seems to be uninitialized when it is dereferenced. This would also happen when the initial loop test is false.
BTW, on my system, I get a compile error from g++ and latest cppfront git.
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Beta Was this translation helpful? Give feedback.
All reactions