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

            Bug ID: 119027
           Summary: Problem of 'case' statement not in switch statement
                    and maybe gcc 10 accepts invalid
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qurong at ios dot ac.cn
  Target Milestone: ---

For this program:


template < typename T > void f(int i) {
    switch (i) if constexpr (false) {
    case 42:;
    }
}
int main() {
    int a = 9;
    f <int>(a);
    return 0;
}


This causes an error in clang and msvc, but gcc didn't report the error. 

Compiler Explorer link: https://godbolt.org/z/KhKqbqePv

Reply via email to