[Issue 16312] "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 14:18:37 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16312
Mathias Lang <mathias.lang at sociomantic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mathias.lang at sociomantic.co
| |m
--- Comment #1 from Mathias Lang <mathias.lang at sociomantic.com> ---
Note: Only when compiled with `-de`.
They are two things at play here:
- First, when the compiler encounter an error, it 'poison' the AST node.
That can lead to wrong error messages in places not adjusted to deal with the
poisoning.
- Second, the compiler treat a non-fatal error (e.g. a warning when `-w` is
provided or a deprecation when `-de` is provided) as a fatal one. This can have
extremely dangerous consequences, e.g. the following will still compiles, just
have different behaviour:
```
class Deprecated
{
int j;
this (T) (T i)
{
this.j = (i, T.init);
}
}
template Foo (T) if (__traits(compiles, { T a = new T(42); }))
{
enum Foo = "First instance";
}
template Foo (T) if (!__traits(compiles, { T a = new T(42); }))
{
enum Foo = "Second instance";
}
pragma(msg, Foo!(Deprecated));
```
The second bug is well known, so I suppose this ER is about the first point ?
--
More information about the Digitalmars-d-bugs
mailing list