kamleshbhalui created this revision. kamleshbhalui added reviewers: rsmith, aaron.ballman. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Fixes duplicate warning emitted by clang when char16_t/char32_t is used in the catch block. Fixes this https://bugs.llvm.org/show_bug.cgi?id=46425 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D82446 Files: clang/lib/Parse/ParseExprCXX.cpp clang/test/Parser/cxx98-char.cpp Index: clang/test/Parser/cxx98-char.cpp =================================================================== --- /dev/null +++ clang/test/Parser/cxx98-char.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++11 -Wc++98-compat -verify=cxx11 -fcxx-exceptions %s +void foo() +{ + try { } + catch (char16_t b) {} // cxx11-warning {{'char16_t' type specifier is incompatible with C++98}} + catch (char32_t c) {} // cxx11-warning {{'char32_t' type specifier is incompatible with C++98}} +} Index: clang/lib/Parse/ParseExprCXX.cpp =================================================================== --- clang/lib/Parse/ParseExprCXX.cpp +++ clang/lib/Parse/ParseExprCXX.cpp @@ -2270,7 +2270,6 @@ /// bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) { ParseSpecifierQualifierList(DS, AS_none, DeclSpecContext::DSC_type_specifier); - DS.Finish(Actions, Actions.getASTContext().getPrintingPolicy()); return false; }
Index: clang/test/Parser/cxx98-char.cpp =================================================================== --- /dev/null +++ clang/test/Parser/cxx98-char.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++11 -Wc++98-compat -verify=cxx11 -fcxx-exceptions %s +void foo() +{ + try { } + catch (char16_t b) {} // cxx11-warning {{'char16_t' type specifier is incompatible with C++98}} + catch (char32_t c) {} // cxx11-warning {{'char32_t' type specifier is incompatible with C++98}} +} Index: clang/lib/Parse/ParseExprCXX.cpp =================================================================== --- clang/lib/Parse/ParseExprCXX.cpp +++ clang/lib/Parse/ParseExprCXX.cpp @@ -2270,7 +2270,6 @@ /// bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) { ParseSpecifierQualifierList(DS, AS_none, DeclSpecContext::DSC_type_specifier); - DS.Finish(Actions, Actions.getASTContext().getPrintingPolicy()); return false; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits