Thread overview
[Issue 16312] "Error: Overlapping fields" caused by use of deprecated features in referred to fields
Jul 22, 2016
Marco Leise
Jul 22, 2016
Mathias Lang
Jul 23, 2016
Marco Leise
Jul 23, 2016
Marco Leise
Jul 05, 2017
Vladimir Panteleev
Dec 17, 2022
Iain Buclaw
July 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16312

Marco Leise <Marco.Leise@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |minor

--
July 22, 2016
https://issues.dlang.org/show_bug.cgi?id=16312

Mathias Lang <mathias.lang@sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathias.lang@sociomantic.co
                   |                            |m

--- Comment #1 from Mathias Lang <mathias.lang@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 ?

--
July 23, 2016
https://issues.dlang.org/show_bug.cgi?id=16312

Marco Leise <Marco.Leise@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |

--- Comment #2 from Marco Leise <Marco.Leise@gmx.de> ---
This report is about the first point, yes. Even if treated as an error, "deprecated" means the compiler can still handle the situation. I suggest, not to poison the AST for "deprecated as error" and "warning as error", but just print the error and continue compilation as normal. (And return -1 from main.) Does that seem feasible?

--
July 23, 2016
https://issues.dlang.org/show_bug.cgi?id=16312

--- Comment #3 from Marco Leise <Marco.Leise@gmx.de> ---
I just got the overlapping fields error after a bunch of "undefined identifier" errors. So it doesn't only happen after deprecated features are used. It happens with both dmd 2.069 and 2.071.1 at least. Other compilers were not tested.

--
July 05, 2017
https://issues.dlang.org/show_bug.cgi?id=16312

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16312

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--