[Issue 10192] New: Fixed size array initialization inconsistency between DeclDefs scope and statement scope
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 28 04:39:21 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10192
Summary: Fixed size array initialization inconsistency between
DeclDefs scope and statement scope
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-05-28 04:39:20 PDT ---
I think it's not OK to accept x3 assignment and refuse the a2 assignment:
struct Foo {
immutable(char)[4] bar;
}
Foo x1 = { "AA" }; // No error.
immutable(char)[4] a1 = "AA"; // No error.
void main() {
Foo x2 = { "AA" }; // No error.
Foo x3 = Foo("AA"); // No error.
immutable(char)[4] a2 = "AA"; // Error: lengths don't match
// for array copy, 4 = 2
}
Kenji Hara answers:
http://forum.dlang.org/post/akeivrewkkhjuapbngel@forum.dlang.org
> This is known static array initializing inconsistency between
> DeclDefs scope and statement scope. I think it is a bug.
See also, where I say that I think all of those five cases should be reported
as bugs:
http://d.puremagic.com/issues/show_bug.cgi?id=3849
--
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