diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 6f277a7488836..23fd894bd6a3e 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -1323,8 +1323,6 @@ static bool getField(InterpState &S, CodePtr OpPC, const Pointer &Ptr, !CheckNull(S, OpPC, Ptr, CSK_Field)) return false; - if (!CheckExtern(S, OpPC, Ptr)) - return false; if (!CheckRange(S, OpPC, Ptr, CSK_Field)) return false; if (!CheckArray(S, OpPC, Ptr)) diff --git a/clang/test/AST/ByteCode/cxx11.cpp b/clang/test/AST/ByteCode/cxx11.cpp index 5daf6adf08cf5..cb05f26d11206 100644 --- a/clang/test/AST/ByteCode/cxx11.cpp +++ b/clang/test/AST/ByteCode/cxx11.cpp @@ -202,3 +202,9 @@ namespace GlobalInitializer { // both-note {{initializer of 'g' is unknown}} }; } + +namespace ExternPointer { + struct S { int a; }; + extern const S pu; + constexpr const int *pua = &pu.a; // Ok. +}