From d6caa9ef4cc68290b0bf33432934cc11dd5594e6 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 15 Oct 2008 20:23:22 +0000 Subject: [PATCH] Fix this bug: 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 | 4 +++- test/SemaCXX/class.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 2fae627ea6..e06761f1ba 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -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(); diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp index 71ad7de914..c3886f3922 100644 --- a/test/SemaCXX/class.cpp +++ b/test/SemaCXX/class.cpp @@ -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}} -- 2.50.1