cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[basic.scope.scope] No definition exists for the term top-level reference #569

Open ranaanoop opened 1 week ago

ranaanoop commented 1 week ago

Full name of submitter: Anoop Rana

Reference (section label): [basic.scope.scope]

Issue description:

The standard uses the term top-level references in basic.scope.scope but it is not clear what it means. The corresponding definition and some examples should be added just like there are example and definition for top-level cv qualifier.

exactly one is an implicit object member function with no ref-qualifier and the types of their object parameters ([dcl.fct]), after removing top-level references, are the same, or

As you can see in the above highlighted reference/quote from standard the term "top-level references" appears.

Suggested resolution:

Add definition for the same. Or change it(the term) and clarify what it means.

AlanVoore commented 1 week ago

Does removing top-level reference mean simply removing the reference. For example, in struct S{void f();}; how will the reference be removed for the object parameter of f. Will it be that S& is changed(transformed) to S or something else is intended here.

frederick-vs-ja commented 6 days ago

I think the meaning can only be "removing references".

AlanVoore commented 4 days ago

@frederick-vs-ja Should this be editorial then?

ranaanoop commented 12 hours ago

@frederick-vs-ja See the compiler divergences also in the following program which may be related to this issue. This is discussed in this thread and all three overloads are ill-formed.

struct C {
    void j(this const C);
    void j() const ;             //#1: Clang:Nope while gcc and msvc:Ok

    //    void f(this C );   
    //    void f(C);            //#2:  EDG: Nope while Clang,gcc and msvc:OK 

    // void k(this const C&);
    // void k() const ;         //#3:   EDG: OK while Clang, gcc and msvc:Nope

};