aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-10-10 05:02:54 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-10-10 05:02:54 +0000
commit17a27b4f0c4ce1f151263c1919dba4fd2231eedc (patch)
treec79be0800daaa4e6c1647924399c5e22fb0b7902 /gcc/cp/init.c
parentc69c9b36a97fddbde2112a5f8d50a4aabe13a19a (diff)
downloadgcc-17a27b4f0c4ce1f151263c1919dba4fd2231eedc.zip
gcc-17a27b4f0c4ce1f151263c1919dba4fd2231eedc.tar.gz
gcc-17a27b4f0c4ce1f151263c1919dba4fd2231eedc.tar.bz2
re PR c++/17867 ("void" instead of class name in error message)
PR c++/17867 * error.c (dump_expr): Correct handling of AGGR_INIT_EXPRs using a constructor. PR c++/17670 * init.c (build_new): Correct comments. * parser.c (cp_parser_new_expression): Use NULL_TREE for nelts in the non-array case. PR c++/17821 * parser.c (cp_parser_postfix_dot_deref_expression): If the pseduo-destructor-name production does not work, fall back to the ordinary production. PR c++/17826 * tree.c (cp_tree_equal): Handle a BASELINK. PR c++/17687 * g++.dg/parse/error19.C: New test. PR c++/17670 * g++.dg/init/new11.C: New test. PR c++/17821 * g++.dg/parse/error20.C: New test. PR c++/17826 * g++.dg/template/crash24.C: New test. From-SVN: r88836
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index ceb6d69..2d04334 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1606,31 +1606,14 @@ build_builtin_delete_call (tree addr)
return build_call (global_delete_fndecl, build_tree_list (NULL_TREE, addr));
}
-/* Generate a C++ "new" expression. DECL is either a TREE_LIST
- (which needs to go through some sort of groktypename) or it
- is the name of the class we are newing. INIT is an initialization value.
- It is either an EXPRLIST, an EXPR_NO_COMMAS, or something in braces.
- If INIT is void_type_node, it means do *not* call a constructor
- for this instance.
-
- For types with constructors, the data returned is initialized
- by the appropriate constructor.
-
- Whether the type has a constructor or not, if it has a pointer
- to a virtual function table, then that pointer is set up
- here.
-
- Unless I am mistaken, a call to new () will return initialized
- data regardless of whether the constructor itself is private or
- not. NOPE; new fails if the constructor is private (jcm).
-
- Note that build_new does nothing to assure that any special
- alignment requirements of the type are met. Rather, it leaves
- it up to malloc to do the right thing. Otherwise, folding to
- the right alignment cal cause problems if the user tries to later
- free the memory returned by `new'.
-
- PLACEMENT is the `placement' list for user-defined operator new (). */
+/* Generate a representation for a C++ "new" expression. PLACEMENT is
+ a TREE_LIST of placement-new arguments (or NULL_TREE if none). If
+ NELTS is NULL, TYPE is the type of the storage to be allocated. If
+ NELTS is not NULL, then this is an array-new allocation; TYPE is
+ the type of the elements in the array and NELTS is the number of
+ elements in the array. INIT, if non-NULL, is the initializer for
+ the new object. If USE_GLOBAL_NEW is true, then the user
+ explicitly wrote "::new" rather than just "new". */
tree
build_new (tree placement, tree type, tree nelts, tree init,