mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 20:20:54 +00:00
[clang][Interp] Add a failing test case
This commit is contained in:
parent
f508d9b1d4
commit
4a6a4f84a7
@ -451,3 +451,40 @@ namespace ConditionalInit {
|
||||
static_assert(getS(true).a == 12, "");
|
||||
static_assert(getS(false).a == 13, "");
|
||||
};
|
||||
/// FIXME: The following tests are broken.
|
||||
/// They are using CXXDefaultInitExprs which contain a CXXThisExpr. The This pointer
|
||||
/// in those refers to the declaration we are currently initializing, *not* the
|
||||
/// This pointer of the current stack frame. This is something we haven't
|
||||
/// implemented in the new interpreter yet.
|
||||
namespace DeclRefs {
|
||||
struct A{ int m; const int &f = m; }; // expected-note {{implicit use of 'this'}}
|
||||
|
||||
constexpr A a{10}; // expected-error {{must be initialized by a constant expression}}
|
||||
static_assert(a.m == 10, "");
|
||||
static_assert(a.f == 10, ""); // expected-error {{not an integral constant expression}} \
|
||||
// expected-note {{read of object outside its lifetime}}
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
int z = 1337;
|
||||
constexpr int a() const {
|
||||
A b{this->z};
|
||||
|
||||
return b.f;
|
||||
}
|
||||
};
|
||||
constexpr Foo f;
|
||||
static_assert(f.a() == 1337, "");
|
||||
|
||||
|
||||
struct B {
|
||||
A a = A{100};
|
||||
};
|
||||
constexpr B b;
|
||||
/// FIXME: The following two lines don't work because we don't get the
|
||||
/// pointers on the LHS correct. They make us run into an assertion
|
||||
/// in CheckEvaluationResult. However, this may just be caused by the
|
||||
/// problems in the previous examples.
|
||||
//static_assert(b.a.m == 100, "");
|
||||
//static_assert(b.a.f == 100, "");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user