digitalmars.D.bugs - [Issue 18030] New: Segmentation fault with __traits(getProtection)
- d-bugmail puremagic.com (52/52) Dec 04 2017 https://issues.dlang.org/show_bug.cgi?id=18030
https://issues.dlang.org/show_bug.cgi?id=18030 Issue ID: 18030 Summary: Segmentation fault with __traits(getProtection) on template function. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dmdreport123 yandex.ru The following code causes dmd to crash with a segmentation fault: ---- struct S(T) { T var; pragma( msg, "Inside S: func() is ", __traits(getProtection, __traits(getMember, T, "func")) ); } class C { alias Al = S!C; static int func(U)(U var) { return 123; } pragma( msg, "Inside C: func() is ", __traits(getProtection, __traits(getMember, C, "func")) ) } void main() {} ---- $ dmd app.d Inside S: func() is Segmentation fault ---- This error first appeared in dmd2.075. Here is a simple test project on github and tests results from travis-ci. https://github.com/Betelgeyser/getprotectionbug https://travis-ci.org/Betelgeyser/getprotectionbug If C.func() has no template parameters or __traits(getProtection) is not called inside struct S, then the code compiles. Calling __traits(getProtection) inside class C does not result in a segfault. Whether S and C are classes or structs does not affect this error. --
Dec 04 2017