Fix void Value across Interpreters
They have different ASTContexts, so the VoidTy is different.
This commit is contained in:
parent
6466a6dfe9
commit
ebd3404baa
@ -146,7 +146,7 @@ namespace cling {
|
|||||||
const clang::ASTContext &C) {
|
const clang::ASTContext &C) {
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
if (C.hasSameType(QT, C.VoidTy))
|
if (QT->isVoidType())
|
||||||
return Value::kVoid;
|
return Value::kVoid;
|
||||||
|
|
||||||
if (const auto *ET = dyn_cast<EnumType>(QT.getTypePtr()))
|
if (const auto *ET = dyn_cast<EnumType>(QT.getTypePtr()))
|
||||||
|
@ -33,5 +33,9 @@ const char* argV[1] = {"cling"};
|
|||||||
ChildInterp.declare("void foo(int i){ printf(\"foo(int) = %d\\n\", i); }\n");
|
ChildInterp.declare("void foo(int i){ printf(\"foo(int) = %d\\n\", i); }\n");
|
||||||
ChildInterp.echo("foo()"); //CHECK: (int) 42
|
ChildInterp.echo("foo()"); //CHECK: (int) 42
|
||||||
ChildInterp.execute("foo(1)"); //CHECK: foo(int) = 1
|
ChildInterp.execute("foo(1)"); //CHECK: foo(int) = 1
|
||||||
|
|
||||||
|
// The following should not crash, even if the child interpreter has a
|
||||||
|
// different ASTContext.VoidTy.
|
||||||
|
ChildInterp.echo("(void)1");
|
||||||
}
|
}
|
||||||
.q
|
.q
|
||||||
|
Loading…
Reference in New Issue
Block a user