]> granicus.if.org Git - clang/commit
Implement C++'s restrictions on the type of an expression passed to a vararg
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 5 Aug 2013 18:49:43 +0000 (18:49 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 5 Aug 2013 18:49:43 +0000 (18:49 +0000)
commit0e2189791acf7fcec4f1b32af24efb2d363f30c1
treeec533c28fecd32d868782f86ac59c5429b87eee1
parent3cb443636fb3ca457994d91527a22c5b159e5169
Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).

Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187735 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaChecking.cpp
lib/Sema/SemaExpr.cpp
test/CXX/expr/expr.post/expr.call/p7-0x.cpp
test/SemaCXX/format-strings-0x.cpp
test/SemaObjC/format-strings-objc.m