cling/test/Interfaces/evaluate.C
Vassil Vassilev 8040f69fc3 Fix the test. In that particular case in ReturnSynthesizer we check whether the
type is trivially copiable and cling::StoredValueRef is not.
We could check for a copy ctor (which is defined in that type), however, that is
not important at the moment. We can readd that logic on use-case.


git-svn-id: http://root.cern.ch/svn/root/trunk@47825 27541ba8-7e3a-0410-8455-c3a389f83636
2012-12-04 16:10:48 +00:00

40 lines
1.5 KiB
C

// RUN: cat %s | %cling -Xclang -verify
// RUN: cat %s | %cling | FileCheck %s
#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/StoredValueRef.h"
cling::StoredValueRef V;
V // CHECK: (cling::StoredValueRef) <<<invalid>>> @0x{{.*}}
gCling->evaluate("return 1;", V);
V // CHECK: (cling::StoredValueRef) boxes [(int) 1]
long LongV = 17;
gCling->evaluate("LongV;", V);
V // CHECK: (cling::StoredValueRef) boxes [(long) 17]
int* IntP = (int*)0x12;
gCling->evaluate("IntP;", V);
V // CHECK: (cling::StoredValueRef) boxes [(int *) 0x12]
cling::StoredValueRef Result;
gCling->evaluate("V", Result);
// Here we check whether the type is trivially copiable and for cling::StoredValueRef it is not.
Result // CHECK: (cling::StoredValueRef) boxes [(void) @0x{{.*}}]
V // CHECK: (cling::StoredValueRef) boxes [(int *) 0x12]
// Savannah #96277
gCling->evaluate("double sin(double); double one = sin(3.141/2);", V);
V // CHECK: (cling::StoredValueRef) boxes [(double) 1.000000e+00]
gCling->process("double sin(double); double one = sin(3.141/2);", &V);
V // CHECK: (cling::StoredValueRef) boxes [(double) 1.000000e+00]
one // CHECK: (double) 1.000
int one; // expected-error {{redefinition of 'one' with a different type: 'int' vs 'double'}} expected-note {{previous definition is here}}
// Make sure that PR#98434 doesn't get reintroduced.
void f(int);
gCling->evaluate("f // expected-error {{cannot initialize return object of type 'void (int)' with an lvalue of type 'void (int)'}}", V);
// end PR#98434