aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-22 20:30:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-22 20:30:13 -0400
commit15c2ccbac51d3e17c4524946bbf1ee44c6e7f811 (patch)
treef22ba99ec6e9d52f0b9159d4d0e1ef5c9e8484e0 /gcc
parent5b960c5a6e8aeb08ad9379b94d12e9f5eda74399 (diff)
downloadgcc-15c2ccbac51d3e17c4524946bbf1ee44c6e7f811.zip
gcc-15c2ccbac51d3e17c4524946bbf1ee44c6e7f811.tar.gz
gcc-15c2ccbac51d3e17c4524946bbf1ee44c6e7f811.tar.bz2
* doc/invoke.texi (C++ Dialect Options): Document -Wno-narrowing.
From-SVN: r176670
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/invoke.texi12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist55.C5
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8cf9313..4481b43 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-22 Jason Merrill <jason@redhat.com>
+
+ * doc/invoke.texi (C++ Dialect Options): Document -Wno-narrowing.
+
2011-07-22 Richard Henderson <rth@redhat.com>
* bb-reorder.c (gate_handle_partition_blocks): Honor optimize.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e56eeaa73..7783786 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2348,6 +2348,18 @@ an instance of a derived class through a pointer to a base class if the
base class does not have a virtual destructor. This warning is enabled
by @option{-Wall}.
+@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
+@opindex Wnarrowing
+@opindex Wno-narrowing
+With -std=c++0x, suppress the diagnostic required by the standard for
+narrowing conversions within @samp{@{ @}}, e.g.
+
+@smallexample
+int i = @{ 2.2 @}; // error: narrowing from double to int
+@end smallexample
+
+This flag can be useful for compiling valid C++98 code in C++0x mode.
+
@item -Wnoexcept @r{(C++ and Objective-C++ only)}
@opindex Wnoexcept
@opindex Wno-noexcept
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist55.C b/gcc/testsuite/g++.dg/cpp0x/initlist55.C
new file mode 100644
index 0000000..cb42e81
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist55.C
@@ -0,0 +1,5 @@
+// Test for -Wno-narrowing
+// { dg-options "-std=c++0x -pedantic-errors -Wno-narrowing" }
+
+int i;
+float d = { i };