[Issue 8400] static array type cannot interpret dynamic array length
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 25 03:39:25 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8400
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #4 from Don <clugdbug at yahoo.com.au> 2012-07-25 03:39:21 PDT ---
(In reply to comment #3)
> > void main(){
> > immutable a = [1,2];
> > int[a.length+0] b; // ok
> > int[a.length ] c; // error
> > }
> >
> > The code should compile.
>
> That code should not compile, in my opinion.
The rule is, in any circumstance where a compile-time value is required, it
will attempt to interpret it at compile time. If it fails, it is an error.
> Nor this one:
>
> immutable a = [1, 2];
> void main() {
> int[a.length] b;
> }
No, that should *definitely* compile.
Global variables with initializers always have the initializer CTFE'd.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list