[Issue 22192] Inconsistent attribute inference for template member function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 8 14:26:08 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22192
Paul Backus <snarwin+bugzilla at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |snarwin+bugzilla at gmail.com
Summary|[The D Bug Tracker] |Inconsistent attribute
| |inference for template
| |member function
--- Comment #1 from Paul Backus <snarwin+bugzilla at gmail.com> ---
More reduced version of the inconsistent attribute inference issue:
---
struct S() {
public void initialize() {}
}
version(NotInferred)
// void()
pragma(msg, typeof(S!().initialize));
else
// pure nothrow @nogc @safe void()
pragma(msg, typeof(S!()().initialize));
---
More reduced version of the alignment issue:
---
struct S {
align(1) int* p;
}
auto fun(int* p) {
S s;
s.p = p;
return s;
}
// pure nothrow @nogc @safe S(int* p)
pragma(msg, typeof(fun));
---
I am not sure the second one is actually a bug. The language spec section on
pointers [1] does not say anything about misaligned pointer variables
potentially causing undefined behavior, and I have not been able to come up
with an example that uses such a variable to cause undefined behavior in @safe
code.
For now, I've edited the name of this bugzilla issue to refer to the
attribute-inference issue in the first example, since that one's definitely a
bug.
[1] https://dlang.org/spec/arrays.html#pointers
--
More information about the Digitalmars-d-bugs
mailing list