Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[namespace.udecl] How to consider the properties of an object parameter in the context other than overload resolution #5439

Open
xmh0511 opened this issue May 4, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 4, 2022

[namespace.udecl] p11 says

The set of declarations named by a using-declarator that inhabits a class C does not include member functions and member function templates of a base class that correspond to (and thus would conflict with) a declaration of a function or function template in C.

According to [basic.scope.scope] p4, which requires they have corresponding object parameters. Although, we have specified the type of implicit object parameter in [over.match.funcs.general] p4, that says

For conversion functions that are implicit object member functions, the function is considered to be a member of the class of the implied object argument for the purpose of defining the type of the implicit object parameter. For non-conversion functions that are implicit object member functions nominated by a using-declaration in a derived class, the function is considered to be a member of the derived class for the purpose of defining the type of the implicit object parameter.

However, such a source transformation and construction are only used in overload resolution, as per [over.match.funcs.general] p1

The source transformations and constructions defined in these subclauses are only for the purpose of describing the overload resolution process.

Consider this example:

struct Base{
   void show(int);
};
struct Derived:Base{
   using Base::show;
   void show(int);
};

How to consider the properties of the object parameter of B::show in this context? Maybe, we should append the following rule

consider the member functions and member function templates of the base class are members of the derived class if the members have implicit object parameters.

The determination of the type of an implicit object parameter should be moved from [over] as a common rule?


whether the constructors have object parameters when comparing whether they correspond?

[dcl.fct] p8 says

The object parameter of a non-static member function is either the explicit object parameter or the implicit object parameter ([over.match.funcs]).

A constructor is a non-static member function, the rule says a constructor should have an object parameter. Although, [over.match.funcs.general] p2 says

For the purposes of overload resolution, both static and non-static member functions have an object parameter, but constructors do not.

Again, the rule is just applied in the overload resolution. Consider this example:

struct Base1{
   Base1(int);
};
struct Derived1:Base1{
   using Base1::Base1;
   Derived(int);
};

Is [namespace.udecl] p11 suitable for this case? Furthermore, Do such two constructors correspond?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant