]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cp-tree.h (tsubst_flags): Remove tf_no_access_control.
authorJason Merrill <jason@redhat.com>
Wed, 25 Jul 2012 14:56:50 +0000 (10:56 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 25 Jul 2012 14:56:50 +0000 (10:56 -0400)
* cp-tree.h (tsubst_flags): Remove tf_no_access_control.
* call.c (standard_conversion): Don't set it.
* class.c (resolve_address_of_overloaded_function): Don't check it.
* decl.c (check_default_argument): Call
perform_implicit_conversion_flags.

From-SVN: r189850

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/testsuite/g++.dg/lto/pr51992_0.C
gcc/testsuite/g++.dg/overload/defarg6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/defarg6.C
gcc/testsuite/g++.old-deja/g++.martin/typedef2.C
gcc/testsuite/g++.old-deja/g++.warn/impint.C

index e9c6cff594037cca1182b73bf05630d90c8a8ffc..e7b47111e264474f7971b8262969803c266bf098 100644 (file)
@@ -1,5 +1,11 @@
 2012-07-25  Jason Merrill  <jason@redhat.com>
 
+       * cp-tree.h (tsubst_flags): Remove tf_no_access_control.
+       * call.c (standard_conversion): Don't set it.
+       * class.c (resolve_address_of_overloaded_function): Don't check it.
+       * decl.c (check_default_argument): Call
+       perform_implicit_conversion_flags.
+
        * pt.c (print_candidates_1): Use inform instead of error.
 
 2012-07-24  Paolo Carlini  <paolo.carlini@oracle.com>
index cf50e88e132eb24c8a3908574d3322403cf06274..5345f2bc9cc4e26457872309e736f87ce317520c 100644 (file)
@@ -1095,8 +1095,6 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
       && expr && type_unknown_p (expr))
     {
       tsubst_flags_t tflags = tf_conv;
-      if (!(flags & LOOKUP_PROTECT))
-       tflags |= tf_no_access_control;
       expr = instantiate_type (to, expr, tflags);
       if (expr == error_mark_node)
        return NULL;
index 7ccbccbc0bd0848fe5884f41375cd772a6b8701f..2f377c8fd589c27a0ee460c57f1e32c0e3f67ed7 100644 (file)
@@ -6878,9 +6878,8 @@ pop_lang_context (void)
 
    If OVERLOAD is for one or more member functions, then ACCESS_PATH
    is the base path used to reference those member functions.  If
-   TF_NO_ACCESS_CONTROL is not set in FLAGS, and the address is
-   resolved to a member function, access checks will be performed and
-   errors issued if appropriate.  */
+   the address is resolved to a member function, access checks will be
+   performed and errors issued if appropriate.  */
 
 static tree
 resolve_address_of_overloaded_function (tree target_type,
@@ -7143,12 +7142,10 @@ resolve_address_of_overloaded_function (tree target_type,
   /* We could not check access to member functions when this
      expression was originally created since we did not know at that
      time to which function the expression referred.  */
-  if (!(flags & tf_no_access_control) 
-      && DECL_FUNCTION_MEMBER_P (fn))
+  if (DECL_FUNCTION_MEMBER_P (fn))
     {
       gcc_assert (access_path);
-      perform_or_defer_access_check (access_path, fn, fn,
-                                    tf_warning_or_error);
+      perform_or_defer_access_check (access_path, fn, fn, flags);
     }
 
   if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
index f1a4b32603ce80aba3c8f66cc75e81b9d8441528..3c1a7bf255a1f9f9ecee5c7d8e018ec88714f67b 100644 (file)
@@ -4170,8 +4170,6 @@ enum tsubst_flags {
                                    conversion might be permissible,
                                    not actually performing the
                                    conversion.  */
-  tf_no_access_control = 1 << 7, /* Do not perform access checks, even
-                                   when issuing other errors.   */
   tf_partial = 1 << 8,          /* Doing initial explicit argument
                                    substitution in fn_type_unification.  */
   /* Convenient substitution flags combinations.  */
index 605058d1fc2bbfdad65bf7b8fe183638d7b1412a..c37787bf9290cb9439bea4d88594e795c092c722 100644 (file)
@@ -10602,19 +10602,8 @@ check_default_argument (tree decl, tree arg)
 
      A default argument expression is implicitly converted to the
      parameter type.  */
-  if (!TREE_TYPE (arg)
-      || !can_convert_arg (decl_type, TREE_TYPE (arg), arg, LOOKUP_NORMAL,
-                          tf_warning_or_error))
-    {
-      if (decl)
-       error ("default argument for %q#D has type %qT",
-              decl, TREE_TYPE (arg));
-      else
-       error ("default argument for parameter of type %qT has type %qT",
-              decl_type, TREE_TYPE (arg));
-
-      return error_mark_node;
-    }
+  perform_implicit_conversion_flags (decl_type, arg, tf_warning_or_error,
+                                    LOOKUP_NORMAL);
 
   if (warn_zero_as_null_pointer_constant
       && c_inhibit_evaluation_warnings == 0
index deb232cc2a983ac34a80acaea61d448947b69e8b..f75abd281a6b169f2fe775df3fc54484e1c5c3a1 100644 (file)
@@ -5,6 +5,7 @@ template<typename Enum>
 class QFlags
 {
     int i;
+public:
     inline QFlags(Enum f) : i(f) {}
 };
 class QString {};
diff --git a/gcc/testsuite/g++.dg/overload/defarg6.C b/gcc/testsuite/g++.dg/overload/defarg6.C
new file mode 100644 (file)
index 0000000..b750184
--- /dev/null
@@ -0,0 +1,7 @@
+class A
+{
+  int i;
+  A(int i): i(i) {}            // { dg-error "private" }
+};
+
+void f (A = 1) { }             // { dg-error "context" }
index f4d84685abe68352def3bc76930569675c523422..15848a13694a8e49277b1e03ecb34a247444bc00 100644 (file)
@@ -8,7 +8,7 @@ enum X{ a, b, c };
 
 struct C
 {
-  static void func (X &ref = a); // { dg-error "default argument" "" }
+  static void func (X &ref = a); // { dg-error "" }
 };
 
 template <typename T>
@@ -21,5 +21,7 @@ void Foo (X & obj)
 {
   D<int>::func (obj);
 
-  D<int>::func (); // { dg-error "default argument" "" }
+  D<int>::func (); // { dg-error "" }
 }
+
+// { dg-prune-output "passing argument" }
index be1bbcbf7f193c39baac2f7ae10365c0b942247f..fa31867654e44d0ae4f0431c72a4230595e9a23e 100644 (file)
@@ -3,5 +3,5 @@
 // Check implicit conversion from string constants into typedefs
 
 typedef char CHAR;
-void f2(CHAR *s="");
+void f2(CHAR *s="");           // { dg-warning "deprecated" }
 
index 1c7f0eb66b17c2bd6af3f97ca3affac0d3f3733a..7ccc73d1fdb1911b601aae461d3e029706644783 100644 (file)
@@ -16,9 +16,9 @@ struct X
 void foo (int);
 void wibble (int);
 void wibble (int, int);
-void punk (int = 3.5);
+void punk (int = 3.5);         // { dg-warning "" } double to int
 void rock ();
-void rock (int, int = 3.5);
+void rock (int, int = 3.5);    // { dg-warning "" } double to int
 
 void fn ()
 {