typeck.c (build_binary_op_nodefault): Change % in format strings to %%.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 17 Jun 1998 18:52:18 +0000 (18:52 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 17 Jun 1998 18:52:18 +0000 (14:52 -0400)
* 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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/typeck.c

index 318b7337178fcdc97cced79bccf75a8167f32920..f3e2cfb7f402106bcae4f0f9b5e38e2a59cb8faf 100644 (file)
@@ -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.
 
 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.
 
index 674d668471bf4dbbf15a743234a51c0bcd025d5a..6e5b102345ae282949f3e215a16864c62110f98e 100644 (file)
@@ -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);
     }
index 84015b07efddae1088a1b11f243ab3421bcfeba7..798915544212c7bb954a71e04bba73b4214ef7f6 100644 (file)
@@ -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;
            }
index 65101266d31f836feee7ee765fffc681fdeed8c7..5176c56711264af55dabed0cb700376c03436f68 100644 (file)
@@ -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)
        {