Jump to page: 1 2
Thread overview
[Issue 23279] Segmentation fault on mixin template + using unknown type
Aug 04, 2022
RazvanN
Aug 04, 2022
RazvanN
Aug 09, 2022
RazvanN
Dec 17, 2022
Iain Buclaw
Jan 02, 2023
Basile-z
Jan 03, 2023
Dlang Bot
Jul 13, 2023
Dlang Bot
Jul 14, 2023
Dlang Bot
Jul 15, 2023
Dlang Bot
August 01, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

--- Comment #1 from Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> ---
This error occurs only on DMD with this test code. But in my project it does not work in both, and I do get "Error: unknown, please file report on issues.dlang.org" instead of a segmentation fault. But 99% chance they are related

--
August 01, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msnmancini@hotmail.com

--
August 01, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

--- Comment #2 from Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> ---
So, the "unknown error" message seems to be caused when that program is built with the unknown type available and it generates the binary for it then the program seems to abort.

When I said that LDC doesn't suffer from this problem I was actually wrong in my statement, it builds and run with the unknown type in the code (probably because it strips something out)

--
August 04, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
Reduced:

```
class Tester
{
    enum a = __traits(hasMember, Tester, "setIt");
    void setIt(Sth sth){}
}
```

--
August 04, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

--- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> ---
It seems like `__traits(hasMember)` gets confused by the forward reference.
Putting the `traits(hasMember)` it after the declaration of `setIt` does not
result in an ice.

--
August 09, 2022
https://issues.dlang.org/show_bug.cgi?id=23279

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
January 02, 2023
https://issues.dlang.org/show_bug.cgi?id=23279

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |b2.temp@gmx.com
           Hardware|x86                         |All
                 OS|Windows                     |All

--- Comment #5 from Basile-z <b2.temp@gmx.com> ---
The thing is that for `__traits(hasMember, Tester, "setIt")`, DMD gags the errors during semantic of `Tester.setIt`.

```
        if (e.ident == Id.hasMember)
        {
            /* Take any errors as meaning it wasn't found
             */
            ex = ex.trySemantic(scx); // try == gag
            return ex ? True() : False();
        }
```

During that same step, the semantic pass for the bad function is also executed (since it's a forward ref) but the error for the bad identifier is just ignored and compilation continues. Finally DMD reaches the code in glue.d and then an assertion fails.

--
January 03, 2023
https://issues.dlang.org/show_bug.cgi?id=23279

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@SixthDot created dlang/dmd pull request #14778 "fix issue 23279 - `hasMember` should not gag sema of forward references" fixing this issue:

- fix issue 23279 - `hasMember` should not gag sema of forward references

  `__traits(hasMember, e1, "e2")` works by looking if `e1.e2` is a valid
expression,
  gagging the semantic errors of the whole expression, however that should just
be done
  while `e2` is being analyzed.

https://github.com/dlang/dmd/pull/14778

--
July 13, 2023
https://issues.dlang.org/show_bug.cgi?id=23279

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 updated dlang/dmd pull request #15406 "Fix Issue 23951 - traits(getMember) does not follow alias this" fixing this issue:

- Fix Issue 23279 - ICE when using traits(hasMember) with an erroneous member

https://github.com/dlang/dmd/pull/15406

--
« First   ‹ Prev
1 2