digitalmars.D.bugs - [Issue 353] New: null passed as a char[] template argument, concatenated with a string literal, is a non-constant expression
- d-bugmail puremagic.com (44/44) Sep 16 2006 http://d.puremagic.com/issues/show_bug.cgi?id=353
- Thomas Kuehne (23/34) Sep 20 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (9/9) Nov 25 2006 http://d.puremagic.com/issues/show_bug.cgi?id=353
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 digitalmars.com
ReportedBy: smjg 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).
--
Sep 16 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail puremagic.com schrieb am 2006-09-16:http://d.puremagic.com/issues/show_bug.cgi?id=353template 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" ----------<snip> Added to DStress as http://dstress.kuehne.cn/compile/o/opCat_21_A.d http://dstress.kuehne.cn/compile/o/opCat_21_B.d http://dstress.kuehne.cn/compile/o/opCat_21_C.d http://dstress.kuehne.cn/compile/o/opCat_21_D.d http://dstress.kuehne.cn/compile/o/opCat_21_E.d http://dstress.kuehne.cn/compile/o/opCat_21_F.d http://dstress.kuehne.cn/compile/o/opCat_22_A.d http://dstress.kuehne.cn/compile/o/opCat_22_B.d http://dstress.kuehne.cn/compile/o/opCat_22_C.d http://dstress.kuehne.cn/compile/o/opCat_22_D.d http://dstress.kuehne.cn/compile/o/opCat_22_E.d http://dstress.kuehne.cn/compile/o/opCat_22_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFEZK9LK5blCcjpWoRAqrbAKCpL/Tfq5p4DhSk3YnpB84rxf4HPgCff/Ek tLKCoqSG5qsDPbP+WgHxtfU= =FZkD -----END PGP SIGNATURE-----
Sep 20 2006
http://d.puremagic.com/issues/show_bug.cgi?id=353
bugzilla digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed DMD 0.175
--
Nov 25 2006









Thomas Kuehne <thomas-dloop kuehne.cn> 