39 lines · cpp
1// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors2// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors3// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors4// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors5// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors6// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors7// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors8 9namespace cwg820 { // cwg820: 2.710export template <class T> struct B {};11// cxx98-17-warning@-1 {{exported templates are unsupported}}12// since-cxx20-error@-2 {{export declaration can only be used within a module interface}}13export template<typename T> void f() {}14// cxx98-17-warning@-1 {{exported templates are unsupported}}15// since-cxx20-error@-2 {{export declaration can only be used within a module interface}}16} // namespace cwg82017 18namespace cwg873 { // cwg873: 3.019#if __cplusplus >= 201103L20template <typename T> void f(T &&);21template <> void f(int &) = delete; // #cwg873-lvalue-ref22template <> void f(int &&) = delete; // #cwg873-rvalue-ref23void g(int i) {24 f(i); // calls f<int&>(int&)25 // since-cxx11-error@-1 {{call to deleted function 'f'}}26 // since-cxx11-note@#cwg873-lvalue-ref {{candidate function [with T = int &] has been implicitly deleted}}27 f(0); // calls f<int>(int&&)28 // since-cxx11-error@-1 {{call to deleted function 'f'}}29 // since-cxx11-note@#cwg873-rvalue-ref {{candidate function [with T = int] has been implicitly deleted}}30}31#endif32} // namespace cwg87333 34// cwg882: 3.535#if __cplusplus >= 201103L36int main() = delete;37// since-cxx11-error@-1 {{'main' is not allowed to be deleted}}38#endif39