r173758 - PR15100: look through type sugar when determining whether we have one of the

Richard Smith richard-llvm at metafoo.co.uk
Mon Jan 28 18:49:48 PST 2013


Author: rsmith
Date: Mon Jan 28 20:49:47 2013
New Revision: 173758

URL: http://llvm.org/viewvc/llvm-project?rev=173758&view=rev
Log:
PR15100: look through type sugar when determining whether we have one of the
forms of 'main' which we accept as an extension.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p2.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=173758&r1=173757&r2=173758&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jan 28 20:49:47 2013
@@ -6647,7 +6647,8 @@ void Sema::CheckMain(FunctionDecl* FD, c
       const PointerType* PT;
       if ((PT = qs.strip(AT)->getAs<PointerType>()) &&
           (PT = qs.strip(PT->getPointeeType())->getAs<PointerType>()) &&
-          (QualType(qs.strip(PT->getPointeeType()), 0) == Context.CharTy)) {
+          Context.hasSameType(QualType(qs.strip(PT->getPointeeType()), 0),
+                              Context.CharTy)) {
         qs.removeConst();
         mismatch = !qs.empty();
       }

Modified: cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p2.cpp?rev=173758&r1=173757&r2=173758&view=diff
==============================================================================
--- cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p2.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p2.cpp Mon Jan 28 20:49:47 2013
@@ -12,6 +12,10 @@
 // RUN: not %clang_cc1 -x c++ %t -std=c++11 -fixit -DTEST9
 // RUN: %clang_cc1 -x c++ %t -std=c++11 -fsyntax-only -DTEST9
 
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST12
+
 #if TEST1
 
 // expected-no-diagnostics
@@ -71,6 +75,25 @@ int main() { } // expected-error{{'main'
 
 constexpr int main() { } // expected-error{{'main' is not allowed to be declared constexpr}}
 
+#elif TEST10
+
+// PR15100
+// expected-no-diagnostics
+typedef char charT;
+int main(int, const charT**) {}
+
+#elif TEST11
+
+// expected-no-diagnostics
+typedef char charT;
+int main(int, charT* const *) {}
+
+#elif TEST12
+
+// expected-no-diagnostics
+typedef char charT;
+int main(int, const charT* const *) {}
+
 #else
 
 #error Unknown test mode





More information about the cfe-commits mailing list