Commit 5e7b9f60 by Jason Merrill Committed by Jason Merrill

cp-tree.h (tsubst_flags): Remove tf_no_access_control.

	* 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
parent 25a92d2f
2012-07-25 Jason Merrill <jason@redhat.com> 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. * pt.c (print_candidates_1): Use inform instead of error.
2012-07-24 Paolo Carlini <paolo.carlini@oracle.com> 2012-07-24 Paolo Carlini <paolo.carlini@oracle.com>
......
...@@ -1095,8 +1095,6 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, ...@@ -1095,8 +1095,6 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
&& expr && type_unknown_p (expr)) && expr && type_unknown_p (expr))
{ {
tsubst_flags_t tflags = tf_conv; tsubst_flags_t tflags = tf_conv;
if (!(flags & LOOKUP_PROTECT))
tflags |= tf_no_access_control;
expr = instantiate_type (to, expr, tflags); expr = instantiate_type (to, expr, tflags);
if (expr == error_mark_node) if (expr == error_mark_node)
return NULL; return NULL;
......
...@@ -6878,9 +6878,8 @@ pop_lang_context (void) ...@@ -6878,9 +6878,8 @@ pop_lang_context (void)
If OVERLOAD is for one or more member functions, then ACCESS_PATH If OVERLOAD is for one or more member functions, then ACCESS_PATH
is the base path used to reference those member functions. If is the base path used to reference those member functions. If
TF_NO_ACCESS_CONTROL is not set in FLAGS, and the address is the address is resolved to a member function, access checks will be
resolved to a member function, access checks will be performed and performed and errors issued if appropriate. */
errors issued if appropriate. */
static tree static tree
resolve_address_of_overloaded_function (tree target_type, resolve_address_of_overloaded_function (tree target_type,
...@@ -7143,12 +7142,10 @@ 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 /* We could not check access to member functions when this
expression was originally created since we did not know at that expression was originally created since we did not know at that
time to which function the expression referred. */ time to which function the expression referred. */
if (!(flags & tf_no_access_control) if (DECL_FUNCTION_MEMBER_P (fn))
&& DECL_FUNCTION_MEMBER_P (fn))
{ {
gcc_assert (access_path); gcc_assert (access_path);
perform_or_defer_access_check (access_path, fn, fn, perform_or_defer_access_check (access_path, fn, fn, flags);
tf_warning_or_error);
} }
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
......
...@@ -4170,8 +4170,6 @@ enum tsubst_flags { ...@@ -4170,8 +4170,6 @@ enum tsubst_flags {
conversion might be permissible, conversion might be permissible,
not actually performing the not actually performing the
conversion. */ 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 tf_partial = 1 << 8, /* Doing initial explicit argument
substitution in fn_type_unification. */ substitution in fn_type_unification. */
/* Convenient substitution flags combinations. */ /* Convenient substitution flags combinations. */
......
...@@ -10602,19 +10602,8 @@ check_default_argument (tree decl, tree arg) ...@@ -10602,19 +10602,8 @@ check_default_argument (tree decl, tree arg)
A default argument expression is implicitly converted to the A default argument expression is implicitly converted to the
parameter type. */ parameter type. */
if (!TREE_TYPE (arg) perform_implicit_conversion_flags (decl_type, arg, tf_warning_or_error,
|| !can_convert_arg (decl_type, TREE_TYPE (arg), arg, LOOKUP_NORMAL, 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;
}
if (warn_zero_as_null_pointer_constant if (warn_zero_as_null_pointer_constant
&& c_inhibit_evaluation_warnings == 0 && c_inhibit_evaluation_warnings == 0
......
...@@ -5,6 +5,7 @@ template<typename Enum> ...@@ -5,6 +5,7 @@ template<typename Enum>
class QFlags class QFlags
{ {
int i; int i;
public:
inline QFlags(Enum f) : i(f) {} inline QFlags(Enum f) : i(f) {}
}; };
class QString {}; class QString {};
......
class A
{
int i;
A(int i): i(i) {} // { dg-error "private" }
};
void f (A = 1) { } // { dg-error "context" }
...@@ -8,7 +8,7 @@ enum X{ a, b, c }; ...@@ -8,7 +8,7 @@ enum X{ a, b, c };
struct C struct C
{ {
static void func (X &ref = a); // { dg-error "default argument" "" } static void func (X &ref = a); // { dg-error "" }
}; };
template <typename T> template <typename T>
...@@ -21,5 +21,7 @@ void Foo (X & obj) ...@@ -21,5 +21,7 @@ void Foo (X & obj)
{ {
D<int>::func (obj); D<int>::func (obj);
D<int>::func (); // { dg-error "default argument" "" } D<int>::func (); // { dg-error "" }
} }
// { dg-prune-output "passing argument" }
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
// Check implicit conversion from string constants into typedefs // Check implicit conversion from string constants into typedefs
typedef char CHAR; typedef char CHAR;
void f2(CHAR *s=""); void f2(CHAR *s=""); // { dg-warning "deprecated" }
...@@ -16,9 +16,9 @@ struct X ...@@ -16,9 +16,9 @@ struct X
void foo (int); void foo (int);
void wibble (int); void wibble (int);
void wibble (int, int); void wibble (int, int);
void punk (int = 3.5); void punk (int = 3.5); // { dg-warning "" } double to int
void rock (); void rock ();
void rock (int, int = 3.5); void rock (int, int = 3.5); // { dg-warning "" } double to int
void fn () void fn ()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment