diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-06-17 18:52:18 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-06-17 14:52:18 -0400 |
commit | 316d4b547e6de0d43de81011508fe23aa009b38a (patch) | |
tree | f0406a4e85227b69fba61107d1c37b346895e280 /gcc | |
parent | 77f194c29905bf0b828f3867a7d44b7368fe0228 (diff) | |
download | gcc-316d4b547e6de0d43de81011508fe23aa009b38a.zip gcc-316d4b547e6de0d43de81011508fe23aa009b38a.tar.gz gcc-316d4b547e6de0d43de81011508fe23aa009b38a.tar.bz2 |
typeck.c (build_binary_op_nodefault): Change % in format strings to %%.
* typeck.c (build_binary_op_nodefault): Change % in format strings
to %%.
* decl.c (grokvardecl): Don't build_static_name for decls that
aren't at namespace scope.
* init.c (perform_member_init): Catch default-initialization of
references.
From-SVN: r20547
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 |
4 files changed, 21 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 318b733..f3e2cfb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +1998-06-17 Jason Merrill <jason@yorick.cygnus.com> + + * typeck.c (build_binary_op_nodefault): Change % in format strings + to %%. + + * decl.c (grokvardecl): Don't build_static_name for decls that + aren't at namespace scope. + + * init.c (perform_member_init): Catch default-initialization of + references. + 1998-06-17 Mark Mitchell <mark@markmitchell.com> * errfn.c (cp_thing): Handle the `%%' formatting sequence. @@ -139,7 +150,7 @@ 1998-06-10 Jason Merrill <jason@yorick.cygnus.com> - * init.c (resolve_offset_ref): Handle default-initialization. + * init.c (perform_member_init): Handle default-initialization. * except.c (build_throw): Handle throwing NULL. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 674d668..6e5b102 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7848,7 +7848,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace) { tree context = in_namespace ? in_namespace : current_namespace; decl = build_decl (VAR_DECL, declarator, complete_type (type)); - if (context != global_namespace && declarator) + if (context != global_namespace && namespace_bindings_p ()) DECL_ASSEMBLER_NAME (decl) = build_static_name (context, declarator); } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 84015b0..7989155 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -200,6 +200,12 @@ perform_member_init (member, name, init, explicit) /* default-initialization. */ if (AGGREGATE_TYPE_P (type)) init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE); + else if (TREE_CODE (type) == REFERENCE_TYPE) + { + cp_error ("default-initialization of `%#D', which has reference type", + member); + init = error_mark_node; + } else init = integer_zero_node; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6510126..5176c56 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3354,9 +3354,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) case TRUNC_MOD_EXPR: case FLOOR_MOD_EXPR: if (code1 == INTEGER_TYPE && integer_zerop (op1)) - cp_warning ("division by zero in `%E % 0'", op0); + cp_warning ("division by zero in `%E %% 0'", op0); else if (code1 == REAL_TYPE && real_zerop (op1)) - cp_warning ("division by zero in `%E % 0.'", op0); + cp_warning ("division by zero in `%E %% 0.'", op0); if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) { |