[Issue 2849] New: Length of a local immutable(char[]) cannot be a template value argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 17 14:57:31 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2849
Summary: Length of a local immutable(char[]) cannot be a
template value argument
Product: D
Version: 2.027
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: clugdbug at yahoo.com.au
struct bar(int n){}
void main(){
immutable(char[]) x = "bug";
bar!(x.length) z;
}
-----
fog.d(3): Error: expression (x = "bug").length is not a valid template value
arg
ument
fog.d(4): Error: template instance fog.bar!((x = "bug").length) error
instantiat
ing
==========
Yet here are two very similar cases which work:
struct bar(int n){}
immutable(char[]) x1 = "bug";
void main(){
immutable(char[]) x2 = "bug";
enum q= x2.length;
bar!(x1.length) z; // ok, it's a global
bar!(q) z2; //ok, it's been copied to an enum
}
Probably related to issue #2841 and issue #2414.
--
More information about the Digitalmars-d-bugs
mailing list