summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-02-11 03:32:18 +0000
committerHans Wennborg <hans@hanshq.net>2015-02-11 03:32:18 +0000
commitf06a0c83eb2f36bf182224a127ad378f42ab5094 (patch)
treec567cf7b649ba868b6b79bf400283cd91e5d49bb /lib/Sema
parent530687c93204132bf1fb29a8c8e227a1eb3f950e (diff)
Merging r228792:
------------------------------------------------------------------------ r228792 | rsmith | 2015-02-10 18:41:33 -0800 (Tue, 10 Feb 2015) | 5 lines Add a warning for direct-list-initialization of a variable with a deduced type (or of a lambda init-capture, which is sort-of such a variable). The semantics of such constructs will change when we implement N3922, so we intend to warn on this in Clang 3.6 then change the semantics in Clang 3.7. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@228799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDecl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index b556f18b76..c6af2edee5 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -8702,6 +8702,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
CheckVariableDeclarationType(VDecl);
if (VDecl->isInvalidDecl())
return;
+
+ // If all looks well, warn if this is a case that will change meaning when
+ // we implement N3922.
+ if (DirectInit && !CXXDirectInit && isa<InitListExpr>(Init)) {
+ Diag(Init->getLocStart(),
+ diag::warn_auto_var_direct_list_init)
+ << FixItHint::CreateInsertion(Init->getLocStart(), "=");
+ }
}
// dllimport cannot be used on variable definitions.