From 027f9c4026a8da9eb2714ae381f1966459dc9839 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 6 Jul 2013 02:13:46 +0000 Subject: Sema: Fix a crash when main is redeclared as a function-template. This boils down to us sending invalid function decls to CheckFunctionDeclaration becauswe we did not consider that CheckMain could cause the decl to be invalid. Instead, interogate the new decl's main-validity and *then* send it over to get CheckFunctionDeclaration'd if it was still valid after calling CheckMain. llvm-svn: 185745 --- clang/test/CXX/basic/basic.start/basic.start.main/p2.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/CXX/basic/basic.start') diff --git a/clang/test/CXX/basic/basic.start/basic.start.main/p2.cpp b/clang/test/CXX/basic/basic.start/basic.start.main/p2.cpp index a5386f1b925..cd912b834d7 100644 --- a/clang/test/CXX/basic/basic.start/basic.start.main/p2.cpp +++ b/clang/test/CXX/basic/basic.start/basic.start.main/p2.cpp @@ -15,6 +15,8 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST11 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST12 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST12 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST13 #if TEST1 @@ -94,6 +96,13 @@ int main(int, charT* const *) {} typedef char charT; int main(int, const charT* const *) {} +#elif TEST13 + +int main(void) {} + +template +int main(void); // expected-error{{'main' cannot be a template}} + #else #error Unknown test mode -- cgit v1.2.3