summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-01-22 01:43:19 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-01-22 01:43:19 +0000
commitb63b6ee9a00ef0710d899df6cfda78a1b8bd762a (patch)
tree16d99f0325f0f71e8c08cdf731bf3631774be256 /clang/lib/Sema/SemaDecl.cpp
parent407e442245b5515c5f110f81b7c1e3f90c40c68c (diff)
downloadbcm5719-llvm-b63b6ee9a00ef0710d899df6cfda78a1b8bd762a.tar.gz
bcm5719-llvm-b63b6ee9a00ef0710d899df6cfda78a1b8bd762a.zip
Enforce restrictions that 'main' is not allowed to be deleted, or to be used by
the program, in C++. (We allow the latter as an extension, since we've always permitted it, and GCC does the same, and our supported C++ ABIs don't do anything special in main.) llvm-svn: 199782
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c08d87d59a8..9dac4d53024 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6809,6 +6809,8 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
}
// If a function is defined as defaulted or deleted, mark it as such now.
+ // FIXME: Does this ever happen? ActOnStartOfFunctionDef forces the function
+ // definition kind to FDK_Definition.
switch (D.getFunctionDefinitionKind()) {
case FDK_Declaration:
case FDK_Definition:
@@ -7670,8 +7672,9 @@ static SourceRange getResultSourceRange(const FunctionDecl *FD) {
}
void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
- // C++11 [basic.start.main]p3: A program that declares main to be inline,
- // static or constexpr is ill-formed.
+ // C++11 [basic.start.main]p3:
+ // A program that [...] declares main to be inline, static or
+ // constexpr is ill-formed.
// C11 6.7.4p4: In a hosted environment, no function specifier(s) shall
// appear in a declaration of main.
// static main is not an error under C99, but we should warn about it.
OpenPOWER on IntegriCloud