15 lines · cpp
1// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx17 %s2// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=pre-cxx20-compat -Wpre-c++20-compat %s3// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20-compat -Wc++20-compat %s4// cxx20-compat-no-diagnostics5 6// cxx17-error@+4 {{unknown type name 'consteval'; did you mean 'constexpr'}}7// cxx17-warning@+3 {{missing 'typename' prior to dependent type name 'T::type' is a C++20 extension}}8// pre-cxx20-compat-warning@+2 {{'consteval' specifier is incompatible with C++ standards before C++20}}9// pre-cxx20-compat-warning@+1 {{missing 'typename' prior to dependent type name 'T::type' is incompatible with C++ standards before C++20}}10template<typename T> consteval T::type f();11 12// cxx17-error@+2 {{unknown type name 'constinit'}}13// pre-cxx20-compat-warning@+1 {{'constinit' specifier is incompatible with C++ standards before C++20}}14constinit int x = 4;15