aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 };