From 478deec11f3349d61b1a922f047dc958dc07262a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 30 Apr 2011 12:37:47 -0700 Subject: gcc-4.6.0: Backport FSF 4.6 branch patches This is set of bugfixes that has been done on FSF gcc-4_2-branch since 4.6.0 was released They will roll into 4.6.1 release once that happens in coming approx 6 months time then we can simply remove them thats the reason so use a separate .inc file to define the SRC_URI additions (From OE-Core rev: b0d5b9f12adbce2c4a0df6059f5671188cd32293) Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- .../gcc-4_6-branch-backports/0034-PR-c-48296.patch | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch') diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch new file mode 100644 index 0000000..084a57c --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch @@ -0,0 +1,102 @@ +From d67703129d516043d4e43bdf79a17889f5abc3f7 Mon Sep 17 00:00:00 2001 +From: jason +Date: Tue, 29 Mar 2011 14:26:33 +0000 +Subject: [PATCH 034/200] PR c++/48296 + * decl.c (cp_finish_decl): Defer validation of constexpr member + functions. + * class.c (finalize_literal_type_property): Validate them here. + * semantics.c (is_valid_constexpr_fn): Don't check completeness. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171675 138bc75d-0d04-0410-961f-82ee72b054a4 + +index 1325260..42066c3 100644 +--- a/gcc/cp/class.c ++++ b/gcc/cp/class.c +@@ -4547,6 +4547,8 @@ type_requires_array_cookie (tree type) + static void + finalize_literal_type_property (tree t) + { ++ tree fn; ++ + if (cxx_dialect < cxx0x + || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) + /* FIXME These constraints seem unnecessary; remove from standard. +@@ -4557,18 +4559,10 @@ finalize_literal_type_property (tree t) + && !TYPE_HAS_CONSTEXPR_CTOR (t)) + CLASSTYPE_LITERAL_P (t) = false; + +- if (!CLASSTYPE_LITERAL_P (t) && !CLASSTYPE_TEMPLATE_INSTANTIATION (t)) +- { +- tree fn; +- for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) +- if (DECL_DECLARED_CONSTEXPR_P (fn) +- && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) +- && !DECL_CONSTRUCTOR_P (fn)) +- { +- error ("enclosing class of %q+D is not a literal type", fn); +- DECL_DECLARED_CONSTEXPR_P (fn) = false; +- } +- } ++ for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) ++ if (DECL_DECLARED_CONSTEXPR_P (fn) ++ && TREE_CODE (fn) != TEMPLATE_DECL) ++ validate_constexpr_fundecl (fn); + } + + /* Check the validity of the bases and members declared in T. Add any +diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c +index 3139ad8..fbd6c97 100644 +--- a/gcc/cp/decl.c ++++ b/gcc/cp/decl.c +@@ -5793,7 +5793,10 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, + } + } + +- if (TREE_CODE (decl) == FUNCTION_DECL) ++ if (TREE_CODE (decl) == FUNCTION_DECL ++ /* For members, defer until finalize_literal_type_property. */ ++ && (!DECL_CLASS_SCOPE_P (decl) ++ || !TYPE_BEING_DEFINED (DECL_CONTEXT (decl)))) + validate_constexpr_fundecl (decl); + + else if (!ensure_literal_type_for_constexpr_object (decl)) +diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c +index a41a1d5..9926d26 100644 +--- a/gcc/cp/semantics.c ++++ b/gcc/cp/semantics.c +@@ -5406,8 +5406,7 @@ is_valid_constexpr_fn (tree fun, bool complain) + } + + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) +- && COMPLETE_TYPE_P (DECL_CONTEXT (fun)) +- && !valid_type_in_constexpr_fundecl_p (DECL_CONTEXT (fun))) ++ && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) + { + ret = false; + if (complain) +new file mode 100644 +index 0000000..4646f82 +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C +@@ -0,0 +1,18 @@ ++// PR c++/48296 ++// { dg-options -std=c++0x } ++ ++struct X ++{ ++ constexpr X() { } ++ constexpr X f(X x) { return x; } ++ constexpr X g(X x); ++}; ++ ++constexpr X X::g(X x) { return x; } ++ ++struct Y ++{ ++ Y() { } ++ constexpr Y f(Y y); // { dg-error "constexpr" } ++ static constexpr Y g(Y y); // { dg-error "constexpr" } ++}; +-- +1.7.0.4 + -- cgit v1.1