summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch
new file mode 100644
index 0000000000..3dbb293b27
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0303-PR-c-48780.patch
@@ -0,0 +1,49 @@
1From 3f78a3111fdfffc067bff19d0d42ffb1040e0fe5 Mon Sep 17 00:00:00 2001
2From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sun, 22 May 2011 00:28:44 +0000
4Subject: [PATCH] PR c++/48780
5 * cvt.c (type_promotes_to): Warn about promoting scoped enums.
6
7git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174022 138bc75d-0d04-0410-961f-82ee72b054a4
8
9index ce4f985..d26d870 100644
10--- a/gcc/cp/cvt.c
11+++ b/gcc/cp/cvt.c
12@@ -1621,6 +1621,9 @@ type_promotes_to (tree type)
13 int precision = MAX (TYPE_PRECISION (type),
14 TYPE_PRECISION (integer_type_node));
15 tree totype = c_common_type_for_size (precision, 0);
16+ if (SCOPED_ENUM_P (type))
17+ warning (OPT_Wabi, "scoped enum %qT will not promote to an integral "
18+ "type in a future version of GCC", type);
19 if (TREE_CODE (type) == ENUMERAL_TYPE)
20 type = ENUM_UNDERLYING_TYPE (type);
21 if (TYPE_UNSIGNED (type)
22new file mode 100644
23index 0000000..ec02d3b
24--- /dev/null
25+++ b/gcc/testsuite/g++.dg/cpp0x/enum13.C
26@@ -0,0 +1,20 @@
27+// PR c++/48780
28+// { dg-options "-std=c++0x -fabi-version=5 -Wabi" }
29+
30+typedef __builtin_va_list __gnuc_va_list;
31+typedef __gnuc_va_list va_list;
32+
33+enum struct A : short { X };
34+
35+void foo(int x, ...) {
36+ va_list vl;
37+ __builtin_va_start(vl, x);
38+ enum A t = __builtin_va_arg(vl, enum A); // { dg-warning "promote" }
39+ __builtin_va_end(vl);
40+}
41+
42+int main() {
43+ foo(0, A::X); // { dg-warning "will not promote" }
44+}
45+
46+// { dg-prune-output "note" }
47--
481.7.0.4
49