]> granicus.if.org Git - clang/commitdiff
Fix this bug:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 15 Oct 2008 20:23:22 +0000 (20:23 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 15 Oct 2008 20:23:22 +0000 (20:23 +0000)
typedef int f();
struct S {
   f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57598 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/class.cpp

index 2fae627ea6ac9dc9b23917584901148661c3de46..e06761f1ba83399ec5dd709fa1c5090769cf0c50 100644 (file)
@@ -353,7 +353,9 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
   }
 
   bool isFunc = D.isFunctionDeclarator();
-  if (!isFunc && D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_typedef) {
+  if (!isFunc &&
+      D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_typedef &&
+      D.getNumTypeObjects() == 0) {
     // Check also for this case:
     //
     // typedef int f();
index 71ad7de91436ee15caed523799e3ad2de8108cf3..c3886f3922ed463f259fe873653bfb9046a7692a 100644 (file)
@@ -26,6 +26,7 @@ public:
 
   typedef int func();
   func tm;
+  func *ptm;
   func btm : 1; // expected-error {{error: bit-field 'btm' with non-integral type}}
   NestedC bc : 1; // expected-error {{error: bit-field 'bc' with non-integral type}}