Bug 22214 – Regression 2.097.0: __traits(compiles) doesn't notice invalid getMember that yields type
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-08-16T12:01:37Z
Last change time
2021-09-07T22:52:00Z
Keywords
pull
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2021-08-16T12:01:37Z
Consider the following code:
struct S
{
struct T
{
}
}
void main() {
const S s;
static if (__traits(compiles, { auto t = __traits(getMember, s, "T"); }))
{
auto t = __traits(getMember, s, "T");
}
}
Since 2.097.0, this fails inside the static if.
Apparently, __traits(compiles) doesn't notice that "auto t = s.T;" is invalid.
Comment #1 by default_357-line — 2021-08-16T12:13:25Z
Simplified:
struct S
{
struct T
{
}
}
void main() {
const S s;
static if (__traits(compiles, { auto t = s.T; }))
{
auto t = s.T;
}
}
Comment #2 by dlang-bot — 2021-08-28T23:40:03Z
@BorisCarvajal created dlang/dmd pull request #13030 "Fix Issue 22214 - [REG 2.097.0] __traits(compiles) doesn't notice invalid getMember that yields type" fixing this issue:
- Fix Issue 22214 - [REG 2.097.0] __traits(compiles) doesn't notice invalid getMember that yields type
https://github.com/dlang/dmd/pull/13030
Comment #3 by dlang-bot — 2021-08-29T01:51:33Z
dlang/dmd pull request #13030 "Fix Issue 22214 - [REG 2.097.0] __traits(compiles) doesn't notice invalid getMember that yields type" was merged into stable:
- 43cdbbb246ef61c9e8f06dd67b9a3a849859abed by Boris Carvajal:
Fix Issue 22214 - [REG 2.097.0] __traits(compiles) doesn't notice invalid getMember that yields type
https://github.com/dlang/dmd/pull/13030
Comment #4 by dlang-bot — 2021-09-07T22:52:00Z
dlang/dmd pull request #13053 "merge stable" was merged into master:
- a07d645c50f0c68271e8f23b9ecdc403e7117497 by Boris Carvajal:
Fix Issue 22214 - [REG 2.097.0] __traits(compiles) doesn't notice invalid getMember that yields type (#13030)
https://github.com/dlang/dmd/pull/13053