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

            Bug ID: 106111
           Summary: -Wc++20-compat doesn't warn about using `requires` as
                    an identifier
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

int requires;

Clang warns about this:

r.C:1:5: warning: 'requires' is a keyword in C++20 [-Wc++20-compat]
int requires;
    ^
1 warning generated.

GCC should do too.

I wonder if we should warn about this by default (and suppress it if
-Wno-c++20-compat is used). A keyword that is a common English word (unlike
decltype, constexpr etc.) deserves a pretty big warning about compat with newer
standards.

Reply via email to