[cfe-commits] r153703 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaOverload.cpp test/CXX/expr/expr.const/p3-0x-nowarn.cpp

Richard Smith richard at metafoo.co.uk
Thu Mar 29 17:23:15 PDT 2012


On Thu, Mar 29, 2012 at 4:39 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> Author: efriedma
> Date: Thu Mar 29 18:39:39 2012
> New Revision: 153703
>
> URL: http://llvm.org/viewvc/llvm-project?rev=153703&view=rev
> Log:
> Extend -Wc++11-narrowing to cover converted constant expressions as well
> as braced-initializers.  <rdar://problem/11121178>.
>
>
> Added:
>    cfe/trunk/test/CXX/expr/expr.const/p3-0x-nowarn.cpp
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>    cfe/trunk/lib/Sema/SemaOverload.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=153703&r1=153702&r2=153703&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar 29
> 18:39:39 2012
> @@ -27,7 +27,12 @@
>  def err_expr_not_cce : Error<
>   "%select{case value|enumerator value|non-type template argument}0 "
>   "is not a constant expression">;
> -def err_cce_narrowing : Error<
> +def err_cce_narrowing : ExtWarn<
> +  "%select{case value|enumerator value|non-type template argument}0 "
> +  "%select{cannot be narrowed from type %2 to %3|"
> +  "evaluates to %2, which cannot be narrowed to type %3}1">,
> +  InGroup<CXX11Narrowing>, DefaultError;
> +def err_cce_narrowing_sfinae : Error<
>   "%select{case value|enumerator value|non-type template argument}0 "
>   "%select{cannot be narrowed from type %2 to %3|"
>   "evaluates to %2, which cannot be narrowed to type %3}1">;
>

We do this sort of thing often enough that we should probably have tablegen
support for it. Could we promote all diagnostics with SFINAE=0 to errors
when they occur in SFINAE contexts, and mark cases like this as
ExtWarn<...>, DefaultError, NoSFINAE; ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120329/69a409bf/attachment.html>


More information about the cfe-commits mailing list