mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Fix bugzilla 24431 - dmd -vcg-ast crashes printing failed template in… (#16916)
This commit is contained in:
parent
e0259d92e7
commit
3f48f53e27
2 changed files with 71 additions and 2 deletions
|
@ -1720,10 +1720,10 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
//printf("FuncDeclaration::toCBuffer() '%s'\n", f.toChars());
|
||||
if (stcToBuffer(buf, f.storage_class))
|
||||
buf.writeByte(' ');
|
||||
typeToBuffer(f.type, f.ident, buf, hgs);
|
||||
auto tf = f.type.isTypeFunction();
|
||||
typeToBuffer(tf, f.ident, buf, hgs);
|
||||
|
||||
if (hgs.hdrgen)
|
||||
if (hgs.hdrgen && tf)
|
||||
{
|
||||
// if the return type is missing (e.g. ref functions or auto)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=20090
|
||||
|
|
69
compiler/test/compilable/vcg_ast_compilable.d
Normal file
69
compiler/test/compilable/vcg_ast_compilable.d
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
REQUIRED_ARGS: -vcg-ast -o-
|
||||
OUTPUT_FILES: compilable/vcg_ast_compilable.d.cg
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
=== compilable/vcg_ast_compilable.d.cg
|
||||
import object;
|
||||
auto binaryFun(E)(E b)
|
||||
{
|
||||
return 'a' == b;
|
||||
}
|
||||
void find(Element)(Element needle) if (is(typeof(binaryFun(needle))))
|
||||
{
|
||||
}
|
||||
void find()(string needle)
|
||||
{
|
||||
}
|
||||
void splitter()
|
||||
{
|
||||
find(3);
|
||||
find("");
|
||||
}
|
||||
binaryFun!int
|
||||
{
|
||||
auto pure nothrow @nogc @safe bool binaryFun(int b)
|
||||
{
|
||||
return 97 == b;
|
||||
}
|
||||
|
||||
}
|
||||
find!int
|
||||
{
|
||||
pure nothrow @nogc @safe void find(int needle)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
binaryFun!string
|
||||
{
|
||||
auto _error_ binaryFun
|
||||
{
|
||||
__error__
|
||||
}
|
||||
|
||||
}
|
||||
find!()
|
||||
{
|
||||
pure nothrow @nogc @safe void find(string needle)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
---
|
||||
*/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24431
|
||||
auto binaryFun(E)(E b)
|
||||
{
|
||||
return 'a' == b;
|
||||
}
|
||||
|
||||
void find(Element)(Element needle) if (is(typeof(binaryFun(needle)))) { }
|
||||
void find()(string needle) { }
|
||||
|
||||
void splitter()
|
||||
{
|
||||
find!int(3);
|
||||
find!()("");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue