Comment #0 by verylonglogin.reg — 2012-01-29T04:13:17Z
---
synchronized int i; // should be definitely an error
if(true) int i; // IMHO, should be an error
if(true) l: f(); // should be probably an error
---
Consider the following D code copied from C:
---
volatile int* p; // volatile statements deprecated; use synchronized statements instead
---
A one is forced to change `volatile` -> `synchronized` after brief look at the error and, if he will be unhappy enough, his program will compile.
Therefore a case with `if` looks lass common but still signalize about an error.
An it is an error in C# (like a variant with label probably because of possible `l: int i;` case): `error CS1023: Embedded statement cannot be a declaration or labeled statement`.
Also look at Issue 2197.
Comment #1 by robert.schadek — 2024-12-13T17:58:12Z