Thread overview
[Issue 19875] [betterC] dmd 2.0.86 Allowed class compile
May 15, 2019
Seb
May 15, 2019
Richard Cattermole
May 15, 2019
kinke@gmx.net
Dec 27, 2022
Iain Buclaw
May 15, 2019
https://issues.dlang.org/show_bug.cgi?id=19875

joaopaulo1339@outlook.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |betterC

--
May 15, 2019
https://issues.dlang.org/show_bug.cgi?id=19875

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #1 from Seb <greeenify@gmail.com> ---
Why should it?
What gave you the impression that it should be?

BetterC doesn't support class allocation (via GC) yet.

In general, classes are a bit challenging with betterC

Though, I recommend reading this great article:

https://theartofmachinery.com/2018/08/13/inheritance_and_polymorphism_2.html

--
May 15, 2019
https://issues.dlang.org/show_bug.cgi?id=19875

--- Comment #2 from joaopaulo1339@outlook.com ---
(In reply to Seb from comment #1)
> Why should it?
> What gave you the impression that it should be?
> 
> BetterC doesn't support class allocation (via GC) yet.
> 
> In general, classes are a bit challenging with betterC
> 
> Though, I recommend reading this great article:
> 
> https://theartofmachinery.com/2018/08/13/inheritance_and_polymorphism_2.html

Because D BetterC page list classes as an removed feature https://dlang.org/spec/betterc.html#consequences

So, if classes are removed, why my example compiles just fine?

--
May 15, 2019
https://issues.dlang.org/show_bug.cgi?id=19875

Richard Cattermole <alphaglosined@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alphaglosined@gmail.com

--- Comment #3 from Richard Cattermole <alphaglosined@gmail.com> ---
The above snippet does indeed compile and run on Windows (I added the pragma).

dmd is including druntime/phobos into the build automatically and has since at least 2.082. Which is providing symbols that shouldn't be available (run.dlang.org it fails on as expected).

--
May 15, 2019
https://issues.dlang.org/show_bug.cgi?id=19875

kinke@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #4 from kinke@gmx.net ---
The reason for this behavior is apparently the extern(D) main function. Make that extern(C), and druntime/Phobos isn't linked. - There's a DMD special case for Windows targets, where the object file containing the D main function gets an embedded linker directive to pull in the library.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--