From a0d4b63d15138ca00e12df3c0573954b07ea40a8 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 2 Sep 2009 21:01:21 +0000 Subject: [PATCH] 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 --- include/clang/AST/Decl.h | 2 +- test/CodeGenCXX/static-data-member.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/CodeGenCXX/static-data-member.cpp 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(Ctx) || isa(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; +} -- 2.50.1