[Issue 16312] New: "Error: Overlapping fields" caused by use of deprecated features in referred to fields
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 22 13:48:34 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16312
Issue ID: 16312
Summary: "Error: Overlapping fields" caused by use of
deprecated features in referred to fields
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: diagnostic, rejects-valid
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: Marco.Leise at gmx.de
The compiler sees fields as overlapping when there are certain types of
deprecated features involved in the types of those fields. The two trigger
features I could make out are using full symbol paths to bypass imports (i.e.
using core.stdc.stdlib.free without importing core.stdc.stdlib) and providing a
struct ctor with all arguments having defaults. If such a "deprecated" struct
is then used with other fields in an aggregate in a way it would not be allowed
for overlapping fields, an error is printed. Here is a short example:
struct Deprecated
{
this(int i = 0) {}
}
class Bogus
{
Deprecated* a = null;
int seems_to_overlap = 0;
}
Deprecation: constructor app.Deprecated.this all parameters have default
arguments, but structs cannot have default constructors.
Error: overlapping default initialization for field a and
seems_to_overlap
Whether or not the compiler would actually silently overlap the two fields
under other circumstances is not known to me.
Related in some way:
https://issues.dlang.org/show_bug.cgi?id=15498
(Unhelpful error message "destructors, postblits and invariants are not allowed
in overlapping fields")
--
More information about the Digitalmars-d-bugs
mailing list