]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
invoke.texi (C++ Dialect Options): Clarify interaction of -Wnarrowing with -std.
authorJonathan Wakely <jwakely@redhat.com>
Fri, 19 Feb 2016 19:32:06 +0000 (19:32 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 19 Feb 2016 19:32:06 +0000 (19:32 +0000)
* doc/invoke.texi (C++ Dialect Options): Clarify interaction of
-Wnarrowing with -std.

From-SVN: r233569

gcc/ChangeLog
gcc/doc/invoke.texi

index c39390c3eab5a9068ac56d8e86362c1d2b438d6f..4227941f76c3ed03b323e895ddf2b538d2d19e19 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-19  Jonathan Wakely  <jwakely@redhat.com>
+
+       * doc/invoke.texi (C++ Dialect Options): Clarify interaction of
+       -Wnarrowing with -std.
+
 2016-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/69851
index 2bd793d13b3f31e1a77d453ca23474ec214199af..c1ab7880eae1f132a310849399a3b930a983b0bb 100644 (file)
@@ -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