Jump to page: 1 2
Thread overview
[Issue 20520] Runtime segfault when taking typeid of a class instanciated within an enum
Jan 21, 2022
RazvanN
Dec 26, 2022
Iain Buclaw
Dec 26, 2022
Iain Buclaw
Dec 26, 2022
Iain Buclaw
Dec 26, 2022
Iain Buclaw
Jan 03, 2023
Dlang Bot
Jan 03, 2023
Walter Bright
Jan 03, 2023
Iain Buclaw
Jan 14, 2023
Dlang Bot
Jan 14, 2023
Dlang Bot
Jan 14, 2023
Dlang Bot
January 20, 2020
https://issues.dlang.org/show_bug.cgi?id=20520

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|normal                      |regression

--- Comment #1 from moonlightsentinel@disroot.org ---
Tested with run.dlang.org:

2.064   to 2.068.2: Success and no output
2.069.2 to 2.070.2: Status -6 with output:
-----
dmd: tocsym.c:246: virtual void
toSymbol(Dsymbol*)::ToSymbol::visit(VarDeclaration*): Assertion `0' failed.
linkage = 0
-----

           2.071.2: Failure with output: --- killed by signal 11
Since      2.072.2: Failure with output: Error: program killed by signal 11


This used to work before https://github.com/dlang/dmd/pull/5161 (found using
Digger)

--
January 21, 2022
https://issues.dlang.org/show_bug.cgi?id=20520

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

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

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
I think that the operation should not be allowed. Doing `enum Bar = new C()` results in "test.d(10): Error: variable `test.main.C` : Unable to initialize enum with class or pointer to struct. Use static const variable instead.". I assume this should outputted in the case of the bug report also.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
GDC and LDC compile and run the test case just fine.  It looks like DMD is not generating an initializer for the manifest constant referenced by `typeid()`.

Tagging as backend issue.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |backend
                 CC|ibuclaw@gdcproject.org      |

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|ibuclaw@gdcproject.org      |

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

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #14777 "fix Issue 20520 - Runtime segfault when taking typeid of a class inst…" fixing this issue:

- fix Issue 20520 - Runtime segfault when taking typeid of a class instanciated within an enum

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

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

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
Razvan is right. This should not compile. An enum's value should evaluate to a constant, not a pointer to the heap.

Just like this does not compile:

    class C { }
    C x = new C();

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #6 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Walter Bright from comment #5)
> Razvan is right. This should not compile. An enum's value should evaluate to a constant, not a pointer to the heap.
> 
> Just like this does not compile:
> 
>     class C { }
>     C x = new C();
It's an rodata constant, you support it in the same way that

   static C x = new C();

is supported.

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14777 "fix Issue 20520 - Runtime segfault when taking typeid of a class inst…" was merged into stable:

- a8f32669c453dd524fa157382a0be870088bde53 by Walter Bright:
  fix Issue 20520 - Runtime segfault when taking typeid of a class instanciated
within an enum

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

--
« First   ‹ Prev
1 2