Bug 22676 – fullyQualifiedName fails to compile with 2.098.1 relese -- there is some issue with call to __traits(isScalar ..

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-15T12:25:00Z
Last change time
2022-01-19T17:14:26Z
Keywords
pull
Assigned to
No Owner
Creator
Puneet Goel

Comments

Comment #0 by puneet — 2022-01-15T12:25:00Z
The following reduced code fails to compile with the release 2.098.1. Earlier versions did not have this issue. // import std.traits: fullyQualifiedName; class foo_base { } class bar_base { static T instance(T)() { return new T(fullyQualifiedName!T); } } class typed_foo(T): foo_base { static class bar: bar_base { this(string) { } foo_base _inst; } } class foo (T): typed_foo!T { static auto _bar_inst() { return bar.instance!bar; } static private ref auto _inst() { return _bar_inst._inst; } mixin (attr_string!(attr_access!(__traits(getAttributes, _inst)))); } template attr_access(A...) { enum attr_access = ""; } template attr_string(string A) { enum string attr_string = ""; } alias foo_frop = foo!frop; class frop { alias type_id = registry!frop; } template registry(T) { enum string FOO = fullyQualifiedName!T; }
Comment #1 by moonlightsentinel — 2022-01-17T08:47:38Z
Reduced example: template fullyQualifiedName(T) { static if (is(T : real)) enum fullyQualifiedName; enum fullyQualifiedName = null; } static auto _inst() { return fullyQualifiedName!(frop); } alias attr = __traits(getAttributes, _inst); class frop { alias type_id = registry!frop; } template registry(T) { enum string FOO = fullyQualifiedName!T; }
Comment #2 by moonlightsentinel — 2022-01-17T09:02:03Z
Comment #3 by ibuclaw — 2022-01-17T09:52:08Z
Thanks, is there a backtrace of the point where it fails? It'll just be a case where some part of the semantic depended on lazy semantic, but now we require upfront semantic to be done by the caller of isBaseOf.
Comment #4 by dlang-bot — 2022-01-17T11:48:39Z
@ibuclaw created dlang/dmd pull request #13541 "fix Issue 22676 - Error: cannot implicitly convert expression 'T!C' of type 'void' to 'string'" fixing this issue: - fix Issue 22676 - Error: cannot implicitly convert expression 'T!C' of type 'void' to 'string' https://github.com/dlang/dmd/pull/13541
Comment #5 by dlang-bot — 2022-01-19T17:14:26Z
dlang/dmd pull request #13541 "fix Issue 22676 - Error: cannot implicitly convert expression 'T!C' of type 'void' to 'string'" was merged into master: - f3edb6d3358d6b01f49569de39312c4c2d6dde5e by Iain Buclaw: fix Issue 22676 - Error: cannot implicitly convert expression 'T!C' of type 'void' to 'string' https://github.com/dlang/dmd/pull/13541