aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-15 20:23:22 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-15 20:23:22 +0000
commitd6caa9ef4cc68290b0bf33432934cc11dd5594e6 (patch)
treea277feee4e860689e91bd6e6819fc20d781907f8
parent5955bfa873e5b23d1aac8f964947522a6304b3f4 (diff)
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
-rw-r--r--lib/Sema/SemaDeclCXX.cpp4
-rw-r--r--test/SemaCXX/class.cpp1
2 files changed, 4 insertions, 1 deletions
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}}