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

            Bug ID: 127780
           Summary: [C++23] Using declaration in if immediately followed
                    by colon incorrectly accepted
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

void f(int x) { if (using T = int; : x) {} }

Compiled with -std=c++23 -pedantic-errors, this should fail to compile - the
grammar for selection-statement and condition certainly don't seem like they
should accept it. However, this does compile on trunk, and on all versions
below down to 11 (given that 11 refuses `void f(int x) { if (using T = int; x)
{} }` also, I assume it's not really a "regression"? idk if it's defined
strictly or not).

Reply via email to