[cfe-commits] r57598 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/class.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Wed Oct 15 13:23:23 PDT 2008


Author: akirtzidis
Date: Wed Oct 15 15:23:22 2008
New Revision: 57598

URL: http://llvm.org/viewvc/llvm-project?rev=57598&view=rev
Log:
Fix this bug:

typedef int f();
struct S {
   f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaCXX/class.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=57598&r1=57597&r2=57598&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Oct 15 15:23:22 2008
@@ -353,7 +353,9 @@
   }
 
   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();

Modified: cfe/trunk/test/SemaCXX/class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/class.cpp?rev=57598&r1=57597&r2=57598&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/class.cpp (original)
+++ cfe/trunk/test/SemaCXX/class.cpp Wed Oct 15 15:23:22 2008
@@ -26,6 +26,7 @@
 
   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}}
 





More information about the cfe-commits mailing list