diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-21 07:20:48 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-21 07:20:48 +0000 |
commit | 1869ca576befbe5457337f88ec2e183aa66eb96f (patch) | |
tree | 5a7be8ba6dc1abd3f95a537fbc5e0ad6a7afb4ef /gcc/cp | |
parent | 63b82f0a74f7ec778b00401a1a273c9df747b758 (diff) | |
download | gcc-1869ca576befbe5457337f88ec2e183aa66eb96f.tar.gz |
2010-01-21 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 156107
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@156108 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 75 | ||||
-rw-r--r-- | gcc/cp/class.c | 5 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 1 | ||||
-rw-r--r-- | gcc/cp/decl.c | 11 | ||||
-rw-r--r-- | gcc/cp/except.c | 13 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 30 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 21 |
7 files changed, 139 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f73d86c22e..43da561ffd2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,78 @@ +2010-01-20 Janis Johnson <janis187@us.ibm.com> + Jason Merrill <jason@redhat.com> + + * mangle.c (write_type): Mangle transparent record as member type. + * semantics.c (begin_class_definition): Recognize decimal classes + and set TYPE_TRANSPARENT_AGGR. + +2010-01-20 Jason Merrill <jason@redhat.com> + + PR c++/42338 + * mangle.c (write_expression): Handle tree codes that have extra + arguments in the middle-end. + +2010-01-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/42038 + * except.c (expand_start_catch_block): Deal correctly with + do_begin_catch returning error_mark_node. + +2010-01-20 Jason Merrill <jason@redhat.com> + + PR c++/41788 + * class.c (layout_class_type): Set packed_maybe_necessary for packed + non-PODs. + + PR c++/41920 + * semantics.c (build_lambda_object): Call mark_used on captured + variables. + + PR c++/40750 + * decl.c (grokdeclarator): Clear type_quals for a member function + declared using a typedef. Don't complain about adding cv-quals + to a function typedef in C++0x mode. + +2010-01-20 Jakub Jelinek <jakub@redhat.com> + + * decl.c (create_array_type_for_decl): Remove set but not used + variable error_msg. Remove break stmts after return stmts. + +2010-01-19 Dodji Seketeli <dodji@redhat.com> + + * error.c (dump_template_parms, count_non_default_template_args): + Revert fix of PR c++/42634. + +2010-01-18 Dodji Seketeli <dodji@redhat.com> + + PR c++/42634 + * error.c (dump_template_parms): Use innermost template + arguments before calling count_non_default_template_args. + (count_non_default_template_args): We are being called with + template innermost arguments now. There is no need to ensure + that again. + +2010-01-18 Dodji Seketeli <dodji@redhat.com> + + PR c++/42766 + * cvt.c (build_expr_type_conversion): Look through OVERLOAD. + +2010-01-17 Dodji Seketeli <dodji@redhat.com> + + PR c++/42697 + *pt.c (tsubst_decl): Revert commit for PR c++/42697. + +2010-01-17 Dodji Seketeli <dodji@redhat.com> + + PR c++/42697 + *pt.c (tsubst_decl): Get the arguments of a specialization from + the specialization template, not from the most general template. + +2010-01-16 Jason Merrill <jason@redhat.com> + + PR c++/42761 + * semantics.c (finish_decltype_type): Within a template, treat + unresolved CALL_EXPR as dependent. + 2010-01-15 Dodji Seketeli <dodji@redhat.com> * error.c (dump_template_parms,count_non_default_template_args): diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 16d566682a6..f88914d3c22 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5216,6 +5216,11 @@ layout_class_type (tree t, tree *virtuals_p) build_decl (input_location, FIELD_DECL, NULL_TREE, char_type_node)); + /* If this is a non-POD, declaring it packed makes a difference to how it + can be used as a field; don't let finalize_record_size undo it. */ + if (TYPE_PACKED (t) && !layout_pod_type_p (t)) + rli->packed_maybe_necessary = true; + /* Let the back end lay out the type. */ finish_record_layout (rli, /*free_p=*/true); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index b4cc2b3ed8c..cbe85965a59 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1203,6 +1203,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain) int win = 0; tree candidate; tree cand = TREE_VALUE (conv); + cand = OVL_CURRENT (cand); if (winner && winner == cand) continue; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2409aa31b15..920d75b75a8 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7422,15 +7422,11 @@ static tree create_array_type_for_decl (tree name, tree type, tree size) { tree itype = NULL_TREE; - const char* error_msg; /* If things have already gone awry, bail now. */ if (type == error_mark_node || size == error_mark_node) return error_mark_node; - /* Assume that everything will go OK. */ - error_msg = NULL; - /* If there are some types which cannot be array elements, issue an error-message and return. */ switch (TREE_CODE (type)) @@ -7441,7 +7437,6 @@ create_array_type_for_decl (tree name, tree type, tree size) else error ("creating array of void"); return error_mark_node; - break; case FUNCTION_TYPE: if (name) @@ -7449,7 +7444,6 @@ create_array_type_for_decl (tree name, tree type, tree size) else error ("creating array of functions"); return error_mark_node; - break; case REFERENCE_TYPE: if (name) @@ -7457,7 +7451,6 @@ create_array_type_for_decl (tree name, tree type, tree size) else error ("creating array of references"); return error_mark_node; - break; case METHOD_TYPE: if (name) @@ -7465,7 +7458,6 @@ create_array_type_for_decl (tree name, tree type, tree size) else error ("creating array of function members"); return error_mark_node; - break; default: break; @@ -8157,7 +8149,7 @@ grokdeclarator (const cp_declarator *declarator, /* This was an error in C++98 (cv-qualifiers cannot be added to a function type), but DR 295 makes the code well-formed by dropping the extra qualifiers. */ - if (pedantic) + if (pedantic && cxx_dialect == cxx98) { tree bad_type = build_qualified_type (type, type_quals); pedwarn (input_location, OPT_pedantic, @@ -9054,6 +9046,7 @@ grokdeclarator (const cp_declarator *declarator, /* The qualifiers on the function type become the qualifiers on the non-static member function. */ memfn_quals |= cp_type_quals (type); + type_quals = TYPE_UNQUALIFIED; } } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 83164c86a7e..4f4f85b490d 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1,6 +1,6 @@ /* Handle exceptional things in C++. Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 + 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Michael Tiemann <tiemann@cygnus.com> Rewritten by Mike Stump <mrs@cygnus.com>, based upon an @@ -417,7 +417,7 @@ tree expand_start_catch_block (tree decl) { tree exp; - tree type; + tree type, init; if (! doing_eh (1)) return NULL_TREE; @@ -450,10 +450,12 @@ expand_start_catch_block (tree decl) /* Call __cxa_end_catch at the end of processing the exception. */ push_eh_cleanup (type); + init = do_begin_catch (); + /* If there's no decl at all, then all we need to do is make sure to tell the runtime that we've begun handling the exception. */ - if (decl == NULL || decl == error_mark_node) - finish_expr_stmt (do_begin_catch ()); + if (decl == NULL || decl == error_mark_node || init == error_mark_node) + finish_expr_stmt (init); /* If the C++ object needs constructing, we need to do that before calling __cxa_begin_catch, so that std::uncaught_exception gets @@ -463,7 +465,7 @@ expand_start_catch_block (tree decl) { exp = do_get_exception_ptr (); initialize_handler_parm (decl, exp); - finish_expr_stmt (do_begin_catch ()); + finish_expr_stmt (init); } /* Otherwise the type uses a bitwise copy, and we don't have to worry @@ -471,7 +473,6 @@ expand_start_catch_block (tree decl) copy with the return value of __cxa_end_catch instead. */ else { - tree init = do_begin_catch (); tree init_type = type; /* Pointers are passed by values, everything else by reference. */ diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 13b0ed47af3..c14f5b7d844 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1732,6 +1732,12 @@ write_type (tree type) if (find_substitution (type)) return; + /* According to the C++ ABI, some library classes are passed the + same as the scalar type of their single member and use the same + mangling. */ + if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type)) + type = TREE_TYPE (first_field (type)); + if (write_CV_qualifiers_for_type (type) > 0) /* If TYPE was CV-qualified, we just wrote the qualifiers; now mangle the unqualified type. The recursive call is needed here @@ -2481,7 +2487,7 @@ write_expression (tree expr) } else { - int i; + int i, len; const char *name; /* When we bind a variable or function to a non-type template @@ -2582,7 +2588,27 @@ write_expression (tree expr) break; default: - for (i = 0; i < TREE_OPERAND_LENGTH (expr); ++i) + /* In the middle-end, some expressions have more operands than + they do in templates (and mangling). */ + switch (code) + { + case PREINCREMENT_EXPR: + case PREDECREMENT_EXPR: + case POSTINCREMENT_EXPR: + case POSTDECREMENT_EXPR: + len = 1; + break; + + case ARRAY_REF: + len = 2; + break; + + default: + len = TREE_OPERAND_LENGTH (expr); + break; + } + + for (i = 0; i < len; ++i) { tree operand = TREE_OPERAND (expr, i); /* As a GNU extension, the middle operand of a diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b2f9fd31f56..d9ba591b3f5 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2368,6 +2368,18 @@ begin_class_definition (tree t, tree attributes) error ("definition of %q#T inside template parameter list", t); return error_mark_node; } + + /* According to the C++ ABI, decimal classes defined in ISO/IEC TR 24733 + are passed the same as decimal scalar types. */ + if (TREE_CODE (t) == RECORD_TYPE) + { + const char *n = type_as_string (t, TFF_CLASS_KEY_OR_ENUM); + if ((strcmp (n, "class std::decimal::decimal32") == 0) + || (strcmp (n, "class std::decimal::decimal64") == 0) + || (strcmp (n, "class std::decimal::decimal128") == 0)) + TYPE_TRANSPARENT_AGGR (t) = 1; + } + /* A non-implicit typename comes from code like: template <typename T> struct A { @@ -4803,6 +4815,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p) if (type && !type_uses_auto (type)) return type; + treat_as_dependent: type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type) @@ -4930,6 +4943,11 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p) && (TREE_CODE (TREE_TYPE (target_type)) == FUNCTION_TYPE || TREE_CODE (TREE_TYPE (target_type)) == METHOD_TYPE)) type = TREE_TYPE (TREE_TYPE (target_type)); + else if (processing_template_decl) + /* Within a template finish_call_expr doesn't resolve + CALL_EXPR_FN, so even though this decltype isn't really + dependent let's defer resolving it. */ + goto treat_as_dependent; else sorry ("unable to determine the declared type of expression %<%E%>", expr); @@ -5402,6 +5420,9 @@ build_lambda_object (tree lambda_expr) tree field = TREE_PURPOSE (node); tree val = TREE_VALUE (node); + if (DECL_P (val)) + mark_used (val); + /* Mere mortals can't copy arrays with aggregate initialization, so do some magic to make it work here. */ if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE) |