diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-09-13 06:06:58 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-09-13 06:06:58 +0000 |
commit | 2c5399f99c95b831fa90fd3a3c1d9719c1dd9441 (patch) | |
tree | ccd0501c062a073d1ebe105ac5eb1a0edeb1ac64 /lib/Sema/SemaTemplate.cpp | |
parent | 78c057e5a16b3ba186cc6453ca26b15745f2b79d (diff) |
Parentheses around address non-type template argument is demoted to an extension warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 6fe8c75441..3537b93e90 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2410,13 +2410,15 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, // corresponding template-parameter is a reference; or DeclRefExpr *DRE = 0; - // Ignore (and complain about) any excess parentheses. + // In C++98/03 mode, give an extension warning on any extra parentheses. + // See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#773 + bool ExtraParens = false; while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) { - if (!Invalid) { + if (!Invalid && !ExtraParens && !S.getLangOptions().CPlusPlus0x) { S.Diag(Arg->getSourceRange().getBegin(), - diag::err_template_arg_extra_parens) + diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); - Invalid = true; + ExtraParens = true; } Arg = Parens->getSubExpr(); @@ -2658,13 +2660,15 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, // -- a pointer to member expressed as described in 5.3.1. DeclRefExpr *DRE = 0; - // Ignore (and complain about) any excess parentheses. + // In C++98/03 mode, give an extension warning on any extra parentheses. + // See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#773 + bool ExtraParens = false; while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) { - if (!Invalid) { + if (!Invalid && !ExtraParens && !getLangOptions().CPlusPlus0x) { Diag(Arg->getSourceRange().getBegin(), - diag::err_template_arg_extra_parens) + diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); - Invalid = true; + ExtraParens = true; } Arg = Parens->getSubExpr(); |