diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h index fa2e03d71190f..34ecdb967960d 100644 --- a/clang/lib/AST/Interp/Pointer.h +++ b/clang/lib/AST/Interp/Pointer.h @@ -215,7 +215,6 @@ class Pointer { assert(Offset == PastEndMark && "cannot get base of a block"); return Pointer(Pointee, Base, 0); } - assert(Offset == Base && "not an inner field"); unsigned NewBase = Base - getInlineDesc()->Offset; return Pointer(Pointee, NewBase, NewBase); } diff --git a/clang/test/AST/Interp/cxx11.cpp b/clang/test/AST/Interp/cxx11.cpp index 0a1e0f3fd28e9..29098ea694c68 100644 --- a/clang/test/AST/Interp/cxx11.cpp +++ b/clang/test/AST/Interp/cxx11.cpp @@ -22,3 +22,9 @@ int array2[recurse2]; // both-warning {{variable length arrays in C++}} \ // both-note {{initializer of 'recurse2' is not a constant expression}} \ // expected-error {{variable length array declaration not allowed at file scope}} \ // ref-warning {{variable length array folded to constant array as an extension}} + +struct S { + int m; +}; +constexpr S s = { 5 }; +constexpr const int *p = &s.m + 1;