diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-02-19 19:32:06 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-02-19 19:32:06 +0000 |
commit | 77a37715c6064b4253dc16d7a69ab1751f30a79a (patch) | |
tree | 35a43f2b53a7861863ed4fb9bfd8b0a37cebc776 /gcc/doc | |
parent | 7a965d512188e997ab9f0f35e9d4b287ca46919c (diff) | |
download | gcc-77a37715c6064b4253dc16d7a69ab1751f30a79a.zip gcc-77a37715c6064b4253dc16d7a69ab1751f30a79a.tar.gz gcc-77a37715c6064b4253dc16d7a69ab1751f30a79a.tar.bz2 |
invoke.texi (C++ Dialect Options): Clarify interaction of -Wnarrowing with -std.
* doc/invoke.texi (C++ Dialect Options): Clarify interaction of
-Wnarrowing with -std.
From-SVN: r233569
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2bd793d..c1ab788 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2756,7 +2756,8 @@ Requires @option{-flto} to be enabled. Enabled by default. @item -Wnarrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -Warn when a narrowing conversion prohibited by C++11 occurs within +With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing +conversion prohibited by C++11 occurs within @samp{@{ @}}, e.g. @smallexample @@ -2765,10 +2766,13 @@ int i = @{ 2.2 @}; // error: narrowing from double to int This flag is included in @option{-Wall} and @option{-Wc++11-compat}. -With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic -required by the standard. Note that this does not affect the meaning -of well-formed code; narrowing conversions are still considered -ill-formed in SFINAE context. +When a later standard is in effect, e.g. when using @option{-std=c++11}, +narrowing conversions are diagnosed by default, as required by the standard. +A narrowing conversion from a constant produces an error, +and a narrowing conversion from a non-constant produces a warning, +but @option{-Wno-narrowing} suppresses the diagnostic. +Note that this does not affect the meaning of well-formed code; +narrowing conversions are still considered ill-formed in SFINAE contexts. @item -Wnoexcept @r{(C++ and Objective-C++ only)} @opindex Wnoexcept |