diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-24 20:24:58 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-24 20:24:58 +0000 |
commit | 42926a065572a63610f651bb1589fe1217e2e0a7 (patch) | |
tree | ca71dc9dbd1c05fe9fec6b665b331079064dab60 /lib/Sema/DeclSpec.cpp | |
parent | 833850bc5d9991c1b0e1fd408b68b6217938ce63 (diff) |
Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
unless they appear in a decl-specifier-seq.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 3cce8cb444..f3ec5656ea 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -668,9 +668,11 @@ bool DeclSpec::SetTypeSpecError() { } bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, - unsigned &DiagID, const LangOptions &Lang) { - // Duplicates turn into warnings pre-C99. - if ((TypeQualifiers & T) && !Lang.C99) + unsigned &DiagID, const LangOptions &Lang, + bool IsTypeSpec) { + // Duplicates are permitted in C99, and are permitted in C++11 unless the + // cv-qualifier appears as a type-specifier. + if ((TypeQualifiers & T) && !Lang.C99 && (!Lang.CPlusPlus0x || IsTypeSpec)) return BadSpecifier(T, T, PrevSpec, DiagID); TypeQualifiers |= T; |