[Issue 10442] RTInfo generation can fail for structs defined in imported modules
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 7 05:22:53 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=10442
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unspecified |D2
--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Rainer Schuetze from comment #0)
> The current default implementation for template RTInfo always sets the value
> 0x12345678, so this should work:
>
> ////////////////
> module s;
>
> struct S
> {
> int x;
> void* p;
> }
>
> ///////////////
> module test;
>
> import s;
>
> struct T
> {
> int x;
> void* p;
> }
>
> void main()
> {
> assert(typeid(T).rtInfo == cast(void*)0x12345678); // ok
> assert(typeid(S).rtInfo == cast(void*)0x12345678); // fails
> }
>
> ////////////////
> but the second assertion triggers if compiled with
>
> dmd test.d
I think the typeid(S) object should not be generated when s.d is not directly
compiled. IOW, `dmd test.d` should cause link failure.
I implemented the behavior in:
https://github.com/D-Programming-Language/dmd/pull/3958
--
More information about the Digitalmars-d-bugs
mailing list