]> gcc.gnu.org Git - gcc.git/commitdiff
typeck.c (convert_for_assignment): Allow boolean integral constant expressions to...
authorJason Merrill <jason@gcc.gnu.org>
Thu, 25 Feb 1999 00:11:35 +0000 (19:11 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 25 Feb 1999 00:11:35 +0000 (19:11 -0500)
* typeck.c (convert_for_assignment): Allow boolean integral constant
expressions to convert to null pointer.
* decl.c (lookup_namespace_name): Resolve namespace aliases.
* class.c (push_nested_class): Allow namespaces.
* decl2.c (set_decl_namespace): Add friendp parameter.
* decl.c (grokfndecl): Pass it.
(grokvardecl): Likewise.
* cp-tree.h: Change declaration.

From-SVN: r25420

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/typeck.c

index 348739f079c0e39c05f7b7744e7625faa760e745..7aa0ff958159827dd6f9ea6e555ba611431155c1 100644 (file)
@@ -1,3 +1,19 @@
+1999-02-24  Mike Stump  <mrs@wrs.com>
+
+       * typeck.c (convert_for_assignment): Allow boolean integral constant
+       expressions to convert to null pointer.
+
+1999-02-24  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * decl.c (lookup_namespace_name): Resolve namespace aliases.
+
+       * class.c (push_nested_class): Allow namespaces.
+
+       * decl2.c (set_decl_namespace): Add friendp parameter.
+       * decl.c (grokfndecl): Pass it.
+       (grokvardecl): Likewise.
+       * cp-tree.h: Change declaration.
+
 1999-02-24  Jason Merrill  <jason@yorick.cygnus.com>
 
        * pt.c (tsubst): Allow an array of explicit size zero.
index d2eaa9751eaf69caa898ed6003a8e89425b1d0aa..7e916123c2bf763c54d2bd9964e048f353e76969 100644 (file)
@@ -4897,9 +4897,9 @@ push_nested_class (type, modify)
 {
   tree context;
 
-  my_friendly_assert (!type || TREE_CODE (type) != NAMESPACE_DECL, 980711);
-
+  /* A namespace might be passed in error cases, like A::B:C.  */
   if (type == NULL_TREE || type == error_mark_node || ! IS_AGGR_TYPE (type)
+      || TREE_CODE (type) == NAMESPACE_DECL
       || TREE_CODE (type) == TEMPLATE_TYPE_PARM
       || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
     return;
index 861f395470071d419db41c2dd0fcebc0576b17ab..62ffbf0e4bd8ab4cec4cadff4288d4ed4db2046f 100644 (file)
@@ -2874,7 +2874,7 @@ extern tree build_expr_from_tree          PROTO((tree));
 extern tree reparse_decl_as_expr               PROTO((tree, tree));
 extern tree finish_decl_parsing                        PROTO((tree));
 extern tree check_cp_case_value                        PROTO((tree));
-extern void set_decl_namespace                  PROTO((tree, tree));
+extern void set_decl_namespace                  PROTO((tree, tree, int));
 extern tree current_decl_namespace              PROTO((void));
 extern void push_decl_namespace                 PROTO((tree));
 extern void pop_decl_namespace                  PROTO((void));
index 95bd6f9a90bbdde7827ef85b7f81c50a081bc84c..4cd37a7a3ff8c6f083e8b95573b5ca27ee7dfb0d 100644 (file)
@@ -5029,6 +5029,8 @@ lookup_namespace_name (namespace, name)
       return error_mark_node;
     }
 
+  namespace = ORIGINAL_NAMESPACE (namespace);
+
   my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373);
   
   val = binding_init (&_b);
@@ -8381,7 +8383,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
 
   /* If this decl has namespace scope, set that up.  */
   if (in_namespace)
-    set_decl_namespace (decl, in_namespace);
+    set_decl_namespace (decl, in_namespace, friendp);
   else if (publicp && ! ctype)
     DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
 
@@ -8666,7 +8668,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
       decl = build_decl (VAR_DECL, declarator, complete_type (type));
 
       if (context)
-       set_decl_namespace (decl, context);
+       set_decl_namespace (decl, context, 0);
 
       context = DECL_CONTEXT (decl);
       if (declarator && context && current_lang_name != lang_name_c)
@@ -8674,7 +8676,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
     }
 
   if (in_namespace)
-    set_decl_namespace (decl, in_namespace);
+    set_decl_namespace (decl, in_namespace, 0);
 
   if (RIDBIT_SETP (RID_EXTERN, specbits))
     {
index 61a88eb4a402745b9b007343a4449287749e0677..cc38dab438f4525b599e78207b48d88006fec8df 100644 (file)
@@ -4186,9 +4186,10 @@ qualified_lookup_using_namespace (name, scope, result, flags)
    outside scope. */
 
 void
-set_decl_namespace (decl, scope)
+set_decl_namespace (decl, scope, friendp)
      tree decl;
      tree scope;
+     int friendp;
 {
   tree old;
   if (scope == std_node)
@@ -4196,7 +4197,8 @@ set_decl_namespace (decl, scope)
   /* Get rid of namespace aliases. */
   scope = ORIGINAL_NAMESPACE (scope);
   
-  if (!is_namespace_ancestor (current_namespace, scope))
+  /* It is ok for friends to be qualified in parallel space.  */
+  if (!friendp && !is_namespace_ancestor (current_namespace, scope))
     cp_error ("declaration of `%D' not in a namespace surrounding `%D'",
              decl, scope);
   DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
index 83d13f195ee14eb197cf044c8110d227729ae9b2..426d02b0903f0dfd656656074bd7189a894b40fd 100644 (file)
@@ -6771,7 +6771,9 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
        }
       return cp_convert (type, rhs);
     }
-  else if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
+  else if (codel == POINTER_TYPE
+          && (coder == INTEGER_TYPE
+              || coder == BOOLEAN_TYPE))
     {
       /* An explicit constant 0 can convert to a pointer,
          but not a 0 that results from casting or folding.  */
This page took 0.115803 seconds and 5 git commands to generate.