https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103922

            Bug ID: 103922
           Summary: fconcepts syntax cause g++ to stop checking access
                    modifiers
           Product: gcc
           Version: 9.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kessido at gmail dot com
  Target Milestone: ---

As far as I could verify this has not been mention anywhere.

Versions: g++-9 (all versions I tried). Was fixed in g++-10.
Compiler flags: -fconcepts -std=c++17
Symptoms: The following line cause any code after it to ignore access
modifiers:

class A {
    int x;
};

template<typename T, typename U>
concept ConceptWithTwoImputs = true;

template<typename T>
concept ConceptThatUsesIt = requires(T t) {
    {t} -> ConceptWithTwoImputs<bool>; // problematic line.
};

int main() {
    A a;
    a.x = 1;
}

If you comment this line, it would result in "error: 'int A::x' is private
within this context".

Reply via email to