[Issue 353] New: null passed as a char[] template argument, concatenated with a string literal, is a non-constant expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 16 16:20:16 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=353
Summary: null passed as a char[] template argument, concatenated
with a string literal, is a non-constant expression
Product: D
Version: 0.166
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: smjg at iname.com
----------
template Qwert(char[] yuiop) {
const char[] Qwert = yuiop ~ "asdfg";
}
void main() {
char[] hjkl = Qwert!(null);
}
----------
D:\My Documents\Programming\D\Tests\bugs\string_template7.d(2): non-constant
expression null ~ "asdfg"
----------
No such error occurs if null is replaced by a string literal, or if line 2 is
changed to
const char[] Qwert = yuiop;
If, starting with the original code, hjkl is declared at module level, the
error is doubled:
----------
template Qwert(char[] yuiop) {
const char[] Qwert = yuiop ~ "asdfg";
}
char[] hjkl = Qwert!(null);
----------
D:\My Documents\Programming\D\Tests\bugs\string_template7a.d(5): non-constant
expression null ~ "asdfg"
D:\My Documents\Programming\D\Tests\bugs\string_template7a.d(2): non-constant
expression null ~ "asdfg"
----------
If hjkl is declared as const and at module level, then the error is tripled (at
lines 5, 2 and 2).
--
More information about the Digitalmars-d-bugs
mailing list