[Issue 23279] New: Segmentation fault on mixin template + using unknown type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Aug 1 02:13:01 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23279
Issue ID: 23279
Summary: Segmentation fault on mixin template + using unknown
type
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: msnmancini at hotmail.com
This is an example code of what is causing a segmentation fault:
```d
template getParams (alias fn)
{
static if ( is(typeof(fn) params == __parameters) )
alias getParams = params;
}
template hasMethod(T, string method, Params...)
{
enum hasMethod = __traits(hasMember, T, method) &&
is(getParams!(__traits(getMember, T, method)) == Params);
}
mixin template TestMx()
{
static if(hasMethod!( typeof(this), "setIt", Tester)){}
}
class Tester
{
mixin TestMx;
void setIt(Sth sth){}
}
```
I don't know (or didn't test) on how to further reduce that, but it seems small
enough.
The error occurs when the mixin TestMx is called.
--
More information about the Digitalmars-d-bugs
mailing list