Bug 1075 – dmd reject valid code

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-03-21T09:28:00Z
Last change time
2014-02-16T15:25:26Z
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2007-03-21T09:28:26Z
class test { static char[] c(){return "whateever;";} int a; class b { mixin(c()); } } void main() { } after reviewing the document i think my example above should be compilable
Comment #1 by bugzilla — 2007-03-21T13:16:43Z
Static strings can be modified at runtime, which is why this isn't compilable (it must be known at compile time). Try doing static const char[] instead, that should work.
Comment #2 by fvbommel — 2007-03-21T18:29:08Z
(From comment #0) > static char[] c(){return "whateever;";} (In reply to comment #1) > Static strings can be modified at runtime, which is why this isn't compilable > (it must be known at compile time). Try doing static const char[] instead, that > should work. That's not a static string, that's a static method he's trying to use for CTFE... (Reopening not because I'm sure this should be allowed, but because it was IMHO closed for the wrong reason)
Comment #3 by davidl — 2007-03-22T00:43:24Z
class test { static const char[] c(){return "whateever;";} int a; class b { mixin(c()); } } void main() { } even above ain't compilabe
Comment #4 by smjg — 2007-03-23T13:38:06Z
I don't quite see why it should. It would be equivalent to class test { int a; class b { whateever; } } but "whateever;" isn't a valid declaration. If that's just a placeholder, using placeholders like this in code samples isn't a good idea. The problem could still be down to what you're trying to use in that place. Always use something that a user can test straight out of the box.
Comment #5 by davidl — 2007-03-27T23:49:16Z
class test { static char[] c(){return "this(){};";} int a; class b { mixin(c()); } } void main() { } heh, this is an example should be compilable ;)
Comment #6 by thomas-dloop — 2007-04-04T12:34:27Z
Comment #7 by davidl — 2007-09-08T23:04:51Z
*** Bug 1447 has been marked as a duplicate of this bug. ***
Comment #8 by davidl — 2007-09-08T23:06:21Z
fixed in dmd 1.021