llvm-project/clang/test/SemaCXX/ms-overload-entry-point.cpp
David Majnemer c729b0b506 [-cxx-abi microsoft] Correctly identify Win32 entry points
Summary:
This fixes several issues with the original implementation:
- Win32 entry points cannot be in namespaces
- A Win32 entry point cannot be a function template, diagnose if we it.
- Win32 entry points cannot be overloaded.
- Win32 entry points implicitly return, similar to main.

Reviewers: rnk, rsmith, whunt, timurrrr

Reviewed By: rnk

CC: cfe-commits, nrieck

Differential Revision: http://llvm-reviews.chandlerc.com/D1683

llvm-svn: 190818
2013-09-16 22:44:20 +00:00

22 lines
606 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s
template <typename T>
int wmain() { // expected-error{{'wmain' cannot be a template}}
return 0;
}
namespace {
int WinMain(void) { return 0; }
int WinMain(int) { return 0; }
}
void wWinMain(void) {} // expected-note{{previous definition is here}}
void wWinMain(int) {} // expected-error{{conflicting types for 'wWinMain'}}
int foo() {
wmain<void>(); // expected-error{{no matching function for call to 'wmain'}}
wmain<int>(); // expected-error{{no matching function for call to 'wmain'}}
WinMain();
return 0;
}