OSDN Git Service

PR c++/48322
[pf3gnuchains/gcc-fork.git] / gcc / cp / typeck.c
index aed2891..a23e274 100644 (file)
@@ -1329,8 +1329,10 @@ structural_comptypes (tree t1, tree t2, int strict)
       break;
 
     case TYPE_PACK_EXPANSION:
-      return same_type_p (PACK_EXPANSION_PATTERN (t1), 
-                          PACK_EXPANSION_PATTERN (t2));
+      return (same_type_p (PACK_EXPANSION_PATTERN (t1),
+                          PACK_EXPANSION_PATTERN (t2))
+             && comp_template_args (PACK_EXPANSION_EXTRA_ARGS (t1),
+                                    PACK_EXPANSION_EXTRA_ARGS (t2)));
 
     case DECLTYPE_TYPE:
       if (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t1)
@@ -2115,6 +2117,7 @@ build_class_member_access_expr (tree object, tree member,
   tree object_type;
   tree member_scope;
   tree result = NULL_TREE;
+  tree using_decl = NULL_TREE;
 
   if (error_operand_p (object) || error_operand_p (member))
     return error_mark_node;
@@ -2343,6 +2346,11 @@ build_class_member_access_expr (tree object, tree member,
        result = build2 (COMPOUND_EXPR, TREE_TYPE (result),
                         object, result);
     }
+  else if ((using_decl = strip_using_decl (member)) != member)
+    result = build_class_member_access_expr (object,
+                                            using_decl,
+                                            access_path, preserve_reference,
+                                            complain);
   else
     {
       if (complain & tf_error)
@@ -2397,7 +2405,8 @@ lookup_destructor (tree object, tree scope, tree dtor_name)
       return error_mark_node;
     }
   expr = lookup_member (dtor_type, complete_dtor_identifier,
-                       /*protect=*/1, /*want_type=*/false);
+                       /*protect=*/1, /*want_type=*/false,
+                       tf_warning_or_error);
   expr = (adjust_result_of_qualified_name_lookup
          (expr, dtor_type, object_type));
   return expr;
@@ -2607,7 +2616,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
        {
          /* Look up the member.  */
          member = lookup_member (access_path, name, /*protect=*/1,
-                                 /*want_type=*/false);
+                                 /*want_type=*/false, complain);
          if (member == NULL_TREE)
            {
              if (complain & tf_error)
@@ -2681,7 +2690,7 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
   ptrmem_type = TREE_TYPE (ptrmem);
   gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type));
   member = lookup_member (ptrmem_type, member_name, /*protect=*/0,
-                         /*want_type=*/false);
+                         /*want_type=*/false, tf_warning_or_error);
   member_type = cp_build_qualified_type (TREE_TYPE (member),
                                         cp_type_quals (ptrmem_type));
   return fold_build3_loc (input_location,
@@ -8416,17 +8425,13 @@ check_literal_operator_args (const_tree decl,
                             bool *long_long_unsigned_p, bool *long_double_p)
 {
   tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
-  if (processing_template_decl)
-    return (argtypes == NULL_TREE
-           || same_type_p (TREE_VALUE (argtypes), void_type_node));
+  if (processing_template_decl || processing_specialization)
+    return argtypes == void_list_node;
   else
     {
       tree argtype;
       int arity;
       int max_arity = 2;
-      bool found_string_p = false;
-      bool maybe_raw_p = false;
-      bool found_size_p = false;
 
       *long_long_unsigned_p = false;
       *long_double_p = false;
@@ -8441,29 +8446,30 @@ check_literal_operator_args (const_tree decl,
 
          if (TREE_CODE (t) == POINTER_TYPE)
            {
+             bool maybe_raw_p = false;
              t = TREE_TYPE (t);
              if (cp_type_quals (t) != TYPE_QUAL_CONST)
                return false;
              t = TYPE_MAIN_VARIANT (t);
-             if (same_type_p (t, char_type_node))
+             if ((maybe_raw_p = same_type_p (t, char_type_node))
+                 || same_type_p (t, wchar_type_node)
+                 || same_type_p (t, char16_type_node)
+                 || same_type_p (t, char32_type_node))
                {
-                 found_string_p = true;
-                 maybe_raw_p = true;
+                 argtype = TREE_CHAIN (argtype);
+                 if (!argtype)
+                   return false;
+                 t = TREE_VALUE (argtype);
+                 if (maybe_raw_p && argtype == void_list_node)
+                   return true;
+                 else if (same_type_p (t, size_type_node))
+                   {
+                     ++arity;
+                     continue;
+                   }
+                 else
+                   return false;
                }
-             else if (same_type_p (t, wchar_type_node))
-               found_string_p = true;
-             else if (same_type_p (t, char16_type_node))
-               found_string_p = true;
-             else if (same_type_p (t, char32_type_node))
-               found_string_p = true;
-             else
-               return false;
-           }
-         else if (same_type_p (t, size_type_node))
-           {
-             if (!found_string_p)
-               return false;
-             found_size_p = true;
            }
          else if (same_type_p (t, long_long_unsigned_type_node))
            {
@@ -8489,10 +8495,7 @@ check_literal_operator_args (const_tree decl,
       if (!argtype)
        return false; /* Found ellipsis.  */
 
-      if (arity > max_arity)
-       return false;
-
-      if (found_string_p && !maybe_raw_p && !found_size_p)
+      if (arity != max_arity)
        return false;
 
       return true;