Bug 15462 – Incorrect error message depending on import order + missing LoC information on generated ctor error

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-12-19T10:33:54Z
Last change time
2022-07-14T13:26:56Z
Assigned to
No Owner
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2015-12-19T10:33:54Z
% cat broken.d class CoreTask : TaskFiber {} import core.thread; class TaskFiber : Fiber {} % dmd broken.d /usr/local/Cellar/dmd/HEAD/include/d2/core/sys/posix/sys/types.d(592): Error: undefined identifier 'c_ulong' /usr/local/Cellar/dmd/HEAD/include/d2/core/sys/posix/sys/types.d(596): Error: undefined identifier 'c_long' core.sys.posix.sys.types imports core.sys.posix.config which publicly imports core.stdc.config which contains c_long/c_ulong in a version ( Posix ) block. Seems to affect linux as well.
Comment #1 by mathias.lang — 2016-04-29T10:29:15Z
Do you know which version are affected ? It isn't a 2.071 regression, 2.070 exhibit the same behaviour. It seems to be a bad diagnostic but since reordering the code to the following: ``` import core.thread; class CoreTask : TaskFiber {} class TaskFiber : Fiber {} ``` (Note how the import moved to the top) gives an (almost) proper error message (LoC information is missing): ``` Error: constructor core.thread.Fiber.this is not accessible from module lol ``` Indeed the generated default ctor is trying to call the base class default ctor, which is private: https://github.com/dlang/druntime/blob/62e43c5f1ed9fc4491cd89ebca08c9dda2c0abe5/src/core/thread.d#L4263-L4270 Edited the issue title accordingly.
Comment #2 by razvan.nitu1305 — 2022-07-14T13:26:56Z
Running this code I end up with: est.d(3): Error: class `test.TaskFiber` cannot implicitly generate a default constructor when base class `core.thread.fiber.Fiber` is missing a default constructor Which is exactly the same no matter how I reorder the statements.