OSDN Git Service

* typeck.c (build_binary_op_nodefault): Change % in format strings
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Jun 1998 18:52:18 +0000 (18:52 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Jun 1998 18:52:18 +0000 (18:52 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20547 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 318b733..f3e2cfb 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 674d668..6e5b102 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 84015b0..7989155 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 6510126..5176c56 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)
        {