mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
Fix Issue 22739 - Segmentation fault in CppMangleVisitor.headOfType (#15098)
This commit is contained in:
parent
997b00bf45
commit
bd23d5972b
2 changed files with 15 additions and 0 deletions
|
@ -213,6 +213,11 @@ private final class CppMangleVisitor : Visitor
|
|||
{
|
||||
auto tf = cast(TypeFunction)this.context.res.asFuncDecl().type;
|
||||
Type rt = preSemantic.nextOf();
|
||||
// https://issues.dlang.org/show_bug.cgi?id=22739
|
||||
// auto return type means that rt is null.
|
||||
// if so, just pick up the type from the instance
|
||||
if (!rt)
|
||||
rt = tf.nextOf();
|
||||
if (tf.isref)
|
||||
rt = rt.referenceTo();
|
||||
auto prev = this.context.push(tf.nextOf());
|
||||
|
|
10
compiler/test/compilable/test22739.d
Normal file
10
compiler/test/compilable/test22739.d
Normal file
|
@ -0,0 +1,10 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=22739
|
||||
|
||||
extern(C++) auto f(T)()
|
||||
{
|
||||
return T.init;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
f!int;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue