Created attachment 1411 [details] gdb output [code] struct Vector(size_t N,E,alias string AS) { } auto someFunc(E)( in Vector!(4,E,"ijka") ) { return Vector!(3,E,"xyz")(); } void main() { someFunc( Vector!(4,float,"ijka")() ); } [/code] % dmd fnc.d zsh: segmentation fault (core dumped) dmd fnc.d if change line 3 [code] void main() { someFunc!float( Vector!(4,float,"ijka")() ); } [/code] program compiles % dmd -v DMD64 D Compiler v2.066.0
Hmm. What's an "alias string" supposed to do? I've never seen that before. Usually for passing compile-time strings, we just write "string". What did you wish to accomplish with "alias string"?
Actually, that doesn't appear to be related to the problem. Removing "alias" still causes the compiler to crash...
I managed to reduce the test case a little more: ------ struct Vector(string x, E) { } void someFunc(E)(Vector!("", E)) { } void main() { someFunc(Vector!("", float)()); } ------ Here's the compiler stacktrace under gdb: ------ Program received signal SIGSEGV, Segmentation fault. 0x000000000047670a in ctfeInterpret(Expression*) () (gdb) bt #0 0x000000000047670a in ctfeInterpret(Expression*) () #1 0x000000000045793a in deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(TypeInstance*) () #2 0x0000000000456734 in deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long) () #3 0x0000000000457307 in deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(TypeStruct*) () #4 0x000000000045a93d in deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long)::DeduceType::visit(Expression*) () #5 0x0000000000456717 in deduceType(RootObject*, Scope*, Type*, Array<TemplateParameter*>*, Array<RootObject*>*, unsigned int*, unsigned long) () #6 0x0000000000459238 in TemplateDeclaration::deduceFunctionTemplateMatch(TemplateInstance*, Scope*, FuncDeclaration*&, Type*, Array<Expression*>*) () #7 0x00000000004635ab in functionResolve(Match*, Dsymbol*, Loc, Scope*, Array<RootObject*>*, Type*, Array<Expression*>*)::ParamDeduce::fp(void*, Dsymbol*) () #8 0x00000000004f9d93 in overloadApply(Dsymbol*, void*, int (*)(void*, Dsymbol*)) () #9 0x0000000000462ebf in functionResolve(Match*, Dsymbol*, Loc, Scope*, Array<RootObject*>*, Type*, Array<Expression*>*) () #10 0x00000000004faabd in resolveFuncCall(Loc, Scope*, Dsymbol*, Array<RootObject*>*, Type*, Array<Expression*>*, int) () #11 0x00000000004e1839 in CallExp::semantic(Scope*) [clone .part.122] () #12 0x0000000000441d0b in ExpStatement::semantic(Scope*) () #13 0x000000000044683f in CompoundStatement::semantic(Scope*) () #14 0x00000000004fc94a in FuncDeclaration::semantic3(Scope*) () #15 0x0000000000407d48 in Module::semantic3() () #16 0x0000000000405484 in tryMain(unsigned long, char const**) () #17 0x00007ffff70b5eed in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 #18 0x0000000000402c75 in _start () ------
This is a regression caused by dmd commit b16f80834e4f9fa9bd62320f132f77fb22fc65b6 (https://github.com/D-Programming-Language/dmd/pull/3824).
https://github.com/D-Programming-Language/dmd/pull/3950
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d99288c36f96c5f837ccc73e7c73ad7087d5b4b2 fix Issue 13417 - segmentation fault when deduce template type https://github.com/D-Programming-Language/dmd/commit/859b7dd5c282175b10b566ad16e6a08c354a4fd8 Merge pull request #3950 from 9rnsr/fix13417 [REG2.066] Issue 13417 - segmentation fault when deduce template type
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/37b15528013b3ed80a6a7cee880a8469ab95315f Merge pull request #3950 from 9rnsr/fix13417 [REG2.066] Issue 13417 - segmentation fault when deduce template type