diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-05-16 11:45:48 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-05-16 11:45:48 +0000 |
commit | 759f25237864f3a3cc23eb01f0c0ce6edcc9342d (patch) | |
tree | 35d811bfa2f7b23474a5253a249175a31f5e84c4 /lib/Sema/SemaInit.cpp | |
parent | f5408fe484495ee4efbdd709c8a2c2fdbbbdb328 (diff) |
PR3009: Get rid of bogus warning for scalar compound literals.
This patch isn't quite ideal in that it eliminates the warning for
constructs like "int a = {1};", where the braces are in fact redundant.
However, that would have required a bunch of refactoring, and it's
much less likely to cause confusion compared to redundant nested braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index a8a0ea3aea..17113f68bd 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -538,7 +538,7 @@ void InitListChecker::CheckExplicitInitList(InitListExpr *IList, QualType &T, } } - if (T->isScalarType()) + if (T->isScalarType() && !TopLevelObject) SemaRef.Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init) << IList->getSourceRange() << CodeModificationHint::CreateRemoval(SourceRange(IList->getLocStart())) |