diff options
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenCXX/member-expressions.cpp | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 323710a104..e489b85291 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1155,6 +1155,9 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { return LV; } + if (VarDecl *VD = dyn_cast<VarDecl>(ND)) + return EmitGlobalVarDeclLValue(*this, E, VD); + assert(false && "Unhandled member declaration!"); return LValue(); } diff --git a/test/CodeGenCXX/member-expressions.cpp b/test/CodeGenCXX/member-expressions.cpp new file mode 100644 index 0000000000..f90b807339 --- /dev/null +++ b/test/CodeGenCXX/member-expressions.cpp @@ -0,0 +1,19 @@ +// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s + +// PR5392 +namespace PR5392 { +struct A +{ + static int a; +}; + +A a1; +void f() +{ + // CHECK: store i32 10, i32* @_ZN6PR53921A1aE + a1.a = 10; + // CHECK: store i32 20, i32* @_ZN6PR53921A1aE + A().a = 20; +} + +} |