diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-02 21:01:21 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-02 21:01:21 +0000 |
commit | a0d4b63d15138ca00e12df3c0573954b07ea40a8 (patch) | |
tree | 5265bb78803bd44c954bba49b20f75c3ca0ab0ea | |
parent | db740922628d5d8bbbd709b18ffae2c3e28c36c6 (diff) |
Fix a crash when referencing static data members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80835 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Decl.h | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/static-data-member.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index e8c29987b0..0fb7fc478d 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -542,7 +542,7 @@ public: if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) ) return true; } - if (isStaticDataMember() && isOutOfLine()) + if (isStaticDataMember()) return true; return false; diff --git a/test/CodeGenCXX/static-data-member.cpp b/test/CodeGenCXX/static-data-member.cpp new file mode 100644 index 0000000000..6e2abcc1ad --- /dev/null +++ b/test/CodeGenCXX/static-data-member.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc -emit-llvm -o - %s +struct S { + static int i; +}; + +void f() { + int a = S::i; +} |