Title
Overlapping concept and requirements scopes
Status
concepts
Section
_N2960_.3.3.9 [basic.scope.req]
Submitter
James Widman

Created on 2009-04-05.00:00:00 last changed 187 months ago

Messages

Date: 2010-03-29.00:00:00

According to _N2960_.3.3.9 [basic.scope.req] paragraph 2,

In a constrained context (_N2914_.14.11 [temp.constrained]), the names of all associated functions inside the concepts named by the concept requirements in the template's requirements are declared in the same scope as the constrained template's template parameters.

This does not appear to cover the case when the requirement appears in a concept definition:

    auto concept B<class T> {
         void f( T );
    }

    auto concept C<class T> {
         typename U = int;
         requires B<U>;  // Is void f(U) placed in the scope of C?

         void g(U x) {
             f(x);   // Ok, finds the 'f(U)' implicitly declared as a
                     // result of the associated requirement B<U>.
         }
    }

    void f(int);

    void g() {
         C<char>::f(42); // Ok?
    }

This program should be well-formed, but the current wording does not make that clear.

Another question that must be addressed is if C also contained an explicit declaration of f(U), either before or after B<U>, and whether it would need a satisfier within a concept map to C.

(See also issue 866.)

History
Date User Action Args
2009-08-03 00:00:00adminsetstatus: open -> concepts
2009-04-05 00:00:00admincreate