]> granicus.if.org Git - clang/commitdiff
Fix a crash when referencing static data members.
authorAnders Carlsson <andersca@mac.com>
Wed, 2 Sep 2009 21:01:21 +0000 (21:01 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 2 Sep 2009 21:01:21 +0000 (21:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80835 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
test/CodeGenCXX/static-data-member.cpp [new file with mode: 0644]

index e8c29987b085b0c8f73c526b6ba5f2b2b2114492..0fb7fc478d55237d99fb965743da74bd65964d98 100644 (file)
@@ -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 (file)
index 0000000..6e2abcc
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-cc -emit-llvm -o - %s
+struct S { 
+  static int i;
+};
+
+void f() { 
+  int a = S::i;
+}