digitalmars.D.bugs - Effectless ExpressionStatement not caught at all
- Stewart Gordon (31/31) Aug 23 2005 Using DMD 0.128, Windows 98SE.
- =?ISO-8859-1?Q?Thomas_K=FChne?= (17/45) Aug 28 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Stewart Gordon (8/15) Aug 28 2005 Q: Which of these testcases is the odd one out? (Scroll down to find ou...
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (26/45) Aug 28 2005 -----BEGIN PGP SIGNED MESSAGE-----
-
Stewart Gordon
(14/22)
Aug 29 2005
In article
, - =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (9/41) Aug 29 2005 If the above is interpreted as an DeclarationStatement the following
- =?ISO-8859-1?Q?Thomas_K=FChne?= (10/56) Aug 29 2005 -----BEGIN PGP SIGNED MESSAGE-----
-
Stewart Gordon
(17/19)
Aug 30 2005
In article
, =?UTF-8?B?VGhvbWFzIEvDvGhu...
Using DMD 0.128, Windows 98SE. The compiler passes this without error: ---------- void main() { int x; int[] y; 5; 10 - 7; x; x + x; x * 5; y.length; y[1]; y.sizeof / x; "Hello, world!"; } ---------- http://www.digitalmars.com/d/statement.html#expression "Expressions that have no effect, like (x + x), are illegal in expression statements." Therefore, apart from the declarations at the top, there is not a single legal statement above. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Aug 23 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stewart Gordon schrieb:Using DMD 0.128, Windows 98SE. The compiler passes this without error: ---------- void main() { int x; int[] y; 5; 10 - 7; x; x + x; x * 5; y.length; y[1]; y.sizeof / x; "Hello, world!"; } ---------- http://www.digitalmars.com/d/statement.html#expression "Expressions that have no effect, like (x + x), are illegal in expression statements." Therefore, apart from the declarations at the top, there is not a single legal statement above.Added to DStress as http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_05.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDEWdv3w+/yD4P9tIRApuHAKCV8YVHPmf3+kiuGpcnyD+TgpbTCgCdFar3 KP7xzBczIni+0dZcTqE/8f0= =ksmY -----END PGP SIGNATURE-----
Aug 28 2005
Q: Which of these testcases is the odd one out? (Scroll down to find out) In article <des1kj$b7a$1 digitaldaemon.com>, =?ISO-8859-1?Q?Thomas_K=FChne?= says...http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_05.dA: http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_B.d Because it doesn't test the same issue as the rest. Rather, it parses as a declaration (declare x to be a pointer to an x). Stewart.
Aug 28 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stewart Gordon schrieb:Q: Which of these testcases is the odd one out? (Scroll down to find out) In article <des1kj$b7a$1 digitaldaemon.com>, =?ISO-8859-1?Q?Thomas_K=FChne?= says...[snip]http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_A.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_B.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_04_C.d http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_05.dA: http://dstress.kuehne.cn/nocompile/e/ExpressionStatement_03_B.d Because it doesn't test the same issue as the rest. Rather, it parses as a declaration (declare x to be a pointer to an x).A: | void main(){ | int x; | x; | } B: | void main(){ | int x; | x * x; | } C: | void main(){ | int x; | x * 5; | } I don't see any pointers. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDEqDy3w+/yD4P9tIRAhGnAKC8Z+podbrpVb/1C2pp6KG1QojBigCeOSkQ 9Ct/NYVLj+B+Vk182gZ1nBA= =L2UH -----END PGP SIGNATURE-----
Aug 28 2005
In article <deu8ef$238k$1 digitaldaemon.com>, =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= says... <snip><snip>Because it doesn't test the same issue as the rest. Rather, it parses as a declaration (declare x to be a pointer to an x).B:<snip>void main(){ int x; x * x; }I don't see any pointers.Welcome to D. The type "pointer to x" is written as "x*". And the simplest declaration has the form Type Identifier; so of course that's a declaration of a pointer. And Walter told us once upon a time that if a Statement can parse as either DeclarationStatement or ExpressionStatement then it is treated as a DeclarationStatement. What did you think "declare x to be a pointer to an x" looked like? Stewart.
Aug 29 2005
Stewart Gordon schrieb:In article <deu8ef$238k$1 digitaldaemon.com>, =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= says... <snip>If the above is interpreted as an DeclarationStatement the following code should compile, shouldn't it? void main(){ int x; x * y; // line 3 } a.d(3): x is used as a type Thomas<snip>Because it doesn't test the same issue as the rest. Rather, it parses as a declaration (declare x to be a pointer to an x).B:<snip>void main(){ int x; x * x; }I don't see any pointers.Welcome to D. The type "pointer to x" is written as "x*". And the simplest declaration has the form Type Identifier; so of course that's a declaration of a pointer. And Walter told us once upon a time that if a Statement can parse as either DeclarationStatement or ExpressionStatement then it is treated as a DeclarationStatement. What did you think "declare x to be a pointer to an x" looked like?
Aug 29 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thomas Kühne schrieb:Stewart Gordon schrieb:Oh I see, my modified frontend is behaving differently than the offical one. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDFAFT3w+/yD4P9tIRAt95AJ92p4JjfHBxtO7Kx8JoiDYAeXJsDQCgxYNz 1jF1oZ0IAI8Zq9wZjcfeCuY= =0xVO -----END PGP SIGNATURE-----In article <deu8ef$238k$1 digitaldaemon.com>, =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= says... <snip>If the above is interpreted as an DeclarationStatement the following code should compile, shouldn't it? void main(){ int x; x * y; // line 3 } a.d(3): x is used as a type<snip>Because it doesn't test the same issue as the rest. Rather, it parses as a declaration (declare x to be a pointer to an x).B:<snip>void main(){ int x; x * x; }I don't see any pointers.Welcome to D. The type "pointer to x" is written as "x*". And the simplest declaration has the form Type Identifier; so of course that's a declaration of a pointer. And Walter told us once upon a time that if a Statement can parse as either DeclarationStatement or ExpressionStatement then it is treated as a DeclarationStatement. What did you think "declare x to be a pointer to an x" looked like?
Aug 29 2005
In article <df0qa7$1602$1 digitaldaemon.com>, =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= says... <snip>If the above is interpreted as an DeclarationStatement the following code should compile, shouldn't it?It doesn't, because x isn't a type. OTOH this will compile: void main() { alias int x; x * y; } or class x { int z; } void main() { x * y; } Stewart.
Aug 30 2005