diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c b/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify=c_mode -ast-dump %s | FileCheck %s --check-prefix=C -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify=cxx_mode -ast-dump %s -x c++| FileCheck %s --check-prefix=CXX +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify=cxx_mode -ast-dump %s -x c++ %stdcxx_11-14 | FileCheck %s --check-prefix=CXX // c_mode-no-diagnostics diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_3.cpp b/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_3.cpp --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_3.cpp +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify -ast-dump %s -x c++| FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify -ast-dump %s %stdcxx_11-14 | FileCheck %s // expected-no-diagnostics // PR47655 diff --git a/clang/test/AST/ast-dump-undeduced-expr.cpp b/clang/test/AST/ast-dump-undeduced-expr.cpp --- a/clang/test/AST/ast-dump-undeduced-expr.cpp +++ b/clang/test/AST/ast-dump-undeduced-expr.cpp @@ -4,4 +4,4 @@ static constexpr auto Bar = ; }; -// CHECK: -VarDecl {{.*}} invalid Bar 'const auto' static constexpr +// CHECK: -VarDecl {{.*}} invalid Bar 'const auto' static {{(inline )?}}constexpr diff --git a/clang/test/AST/sourceranges.cpp b/clang/test/AST/sourceranges.cpp --- a/clang/test/AST/sourceranges.cpp +++ b/clang/test/AST/sourceranges.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s +// RUN: %clang_cc1 -triple i686-mingw32 %stdcxx_11-14 -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple i686-mingw32 -std=c++1z -ast-dump %s | FileCheck %s -check-prefix=CHECK-1Z template diff --git a/clang/test/Analysis/blocks.m b/clang/test/Analysis/blocks.m --- a/clang/test/Analysis/blocks.m +++ b/clang/test/Analysis/blocks.m @@ -14,6 +14,9 @@ __attribute__((visibility("default"))) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__nothrow__)) dispatch_queue_t dispatch_queue_create(const char *label, dispatch_queue_attr_t attr); typedef long dispatch_once_t; void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block); +#if __cplusplus >= 201703L +__attribute__((__nothrow__)) +#endif dispatch_queue_t dispatch_queue_create(const char *label, dispatch_queue_attr_t attr); diff --git a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp --- a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp +++ b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp @@ -1,5 +1,5 @@ // FIXME: Figure out how to use %clang_analyze_cc1 with our lit.local.cfg. -// RUN: %clang_cc1 -analyze -triple x86_64-unknown-linux-gnu \ +// RUN: %clang_cc1 -std=c++14 -analyze -triple x86_64-unknown-linux-gnu \ // RUN: -analyze-function "test()" \ // RUN: -analyzer-checker=core \ // RUN: -analyzer-dump-egraph=%t.dot %s diff --git a/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp b/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp --- a/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp +++ b/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp @@ -21,11 +21,16 @@ typedef __SIZE_TYPE__ size_t; } +#if __cplusplus < 201703L void* operator new(std::size_t) throw(std::bad_alloc); #if __cplusplus < 201103L // expected-note@-2 {{previous declaration}} #endif +#endif + +#if __cplusplus < 201703L void* operator new[](std::size_t) throw(std::bad_alloc); +#endif void operator delete(void*) throw(); // expected-note{{previous declaration}} void operator delete[](void*) throw(); diff --git a/clang/test/CXX/class.access/class.friend/p1.cpp b/clang/test/CXX/class.access/class.friend/p1.cpp --- a/clang/test/CXX/class.access/class.friend/p1.cpp +++ b/clang/test/CXX/class.access/class.friend/p1.cpp @@ -221,13 +221,21 @@ #if __cplusplus >= 201103L constexpr #endif - A::A(); + A::A() +#if __cplusplus >= 201703L + noexcept +#endif + ; friend A::~A(); friend #if __cplusplus >= 201402L constexpr #endif - A &A::operator=(const A&); + A &A::operator=(const A&) +#if __cplusplus >= 201703L + noexcept +#endif + ; }; } @@ -246,7 +254,11 @@ #if __cplusplus >= 201103L constexpr #endif - X::X(const X&); + X::X(const X&) +#if __cplusplus >= 201703L + noexcept +#endif + ; private: A(); // expected-note 2 {{declared private here}} diff --git a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp --- a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp +++ b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp @@ -16,8 +16,10 @@ #endif register int ro; // expected-error {{illegal storage class on file-scoped variable}} -#if __cplusplus >= 201103L // C++11 or later -// expected-warning@-2 {{'register' storage class specifier is deprecated}} +#if __cplusplus >= 201703L +// expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}} +#elif __cplusplus >= 201103L +// expected-warning@-4 {{'register' storage class specifier is deprecated}} #endif register void rf(); // expected-error {{illegal storage class on function}} @@ -37,9 +39,12 @@ }; void foo(auto int ap, register int rp) { -#if __cplusplus >= 201103L // C++11 or later +#if __cplusplus >= 201703L // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} -// expected-warning@-3 {{'register' storage class specifier is deprecated}} +// expected-error@-3 {{ISO C++17 does not allow 'register' storage class specifier}} +#elif __cplusplus >= 201103L +// expected-warning@-5 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} +// expected-warning@-6 {{'register' storage class specifier is deprecated}} #endif auto int abo; #if __cplusplus >= 201103L // C++11 or later @@ -51,8 +56,10 @@ #endif register int rbo; -#if __cplusplus >= 201103L // C++11 or later -// expected-warning@-2 {{'register' storage class specifier is deprecated}} +#if __cplusplus >= 201703L +// expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}} +#elif __cplusplus >= 201103L +// expected-warning@-4 {{'register' storage class specifier is deprecated}} #endif register void rbf(); // expected-error {{illegal storage class on function}} diff --git a/clang/test/CXX/except/except.spec/p2-dynamic-types.cpp b/clang/test/CXX/except/except.spec/p2-dynamic-types.cpp --- a/clang/test/CXX/except/except.spec/p2-dynamic-types.cpp +++ b/clang/test/CXX/except/except.spec/p2-dynamic-types.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -Wno-dynamic-exception-spec -verify %s // Dynamic specifications: valid types. diff --git a/clang/test/CXX/except/except.spec/p9-dynamic.cpp b/clang/test/CXX/except/except.spec/p9-dynamic.cpp --- a/clang/test/CXX/except/except.spec/p9-dynamic.cpp +++ b/clang/test/CXX/except/except.spec/p9-dynamic.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s --check-prefixes=CHECK,CHECK-PRE17 +// RUN: %clang_cc1 %stdcxx_98-14 -no-opaque-pointers %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s --check-prefixes=CHECK,CHECK-PRE17 // RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-apple-darwin10 -std=c++17 -Wno-dynamic-exception-spec -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s --check-prefixes=CHECK,CHECK-17 void external(); diff --git a/clang/test/CXX/stmt.stmt/stmt.select/p3.cpp b/clang/test/CXX/stmt.stmt/stmt.select/p3.cpp --- a/clang/test/CXX/stmt.stmt/stmt.select/p3.cpp +++ b/clang/test/CXX/stmt.stmt/stmt.select/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %stdcxx_98-14 %s // RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++1z -Wc++14-compat -verify %s -DCPP17 int f(); diff --git a/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp b/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp --- a/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp +++ b/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu %s // RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-linux-gnu -std=c++14 %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -triple=x86_64-linux-gnu %s -DCPP11ONLY // C++11 [temp.arg.nontype]p1: diff --git a/clang/test/CXX/temp/temp.res/temp.local/p3.cpp b/clang/test/CXX/temp/temp.res/temp.local/p3.cpp --- a/clang/test/CXX/temp/temp.res/temp.local/p3.cpp +++ b/clang/test/CXX/temp/temp.res/temp.local/p3.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -verify=expected,precxx17 %stdcxx_98-14 %s +// RUN: %clang_cc1 -verify=expected,cxx17 -std=c++17 %s template struct Base { // expected-note@-1 2{{member type 'Base' found by ambiguous name lookup}} @@ -26,7 +27,9 @@ } // expected-error {{expected ';' after class}} WebVector(const WebVector& other) { } // expected-error{{undeclared identifier 'T'}} \ - expected-error{{a type specifier is required}} + precxx17-error{{a type specifier is required}} \ + cxx17-error{{deduction guide declaration without trailing return type}} \ + cxx17-error{{deduction guide cannot have a function definition}} template WebVector& operator=(const C& other) { } // expected-error{{undeclared identifier 'T'}} diff --git a/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp b/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp --- a/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp +++ b/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -fdata-sections -fcolor-diagnostics +// RUN: %clang_cc1 %s -fsyntax-only -verify=expected,precxx17 %stdcxx_11-14 -fdata-sections -fcolor-diagnostics +// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++17 -fdata-sections -fcolor-diagnostics // Warn for any function that // * takes a pointer or a reference to an object (including "this" pointer), @@ -214,10 +215,10 @@ TypedefAligned4 TA8b(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} TypedefAligned4 TA8c = TA8a + TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator+' may result in an unaligned pointer access}} // expected-warning@-1 {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator+' may result in an unaligned pointer access}} - // expected-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + // precxx17-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} TypedefAligned4 TA8d = TA8a - &TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator-' may result in an unaligned pointer access}} // expected-warning@-1 {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator-' may result in an unaligned pointer access}} - // expected-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + // precxx17-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} ++TA8d; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator++' may result in an unaligned pointer access}} --TA8c; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator--' may result in an unaligned pointer access}} UsingAligned4 UA8a(11); diff --git a/clang/test/CodeGenCXX/align-avx-complete-objects.cpp b/clang/test/CodeGenCXX/align-avx-complete-objects.cpp --- a/clang/test/CodeGenCXX/align-avx-complete-objects.cpp +++ b/clang/test/CodeGenCXX/align-avx-complete-objects.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -x c++ %s -O0 -triple=x86_64-apple-darwin -target-feature +avx2 -fmax-type-align=16 -emit-llvm -o - -Werror | FileCheck %s +// RUN: %clang_cc1 -no-opaque-pointers -std=c++14 %s -O0 -triple=x86_64-apple-darwin -target-feature +avx2 -fmax-type-align=16 -emit-llvm -o - -Werror | FileCheck %s // rdar://16254558 typedef float AVX2Float __attribute__((__vector_size__(32))); diff --git a/clang/test/CodeGenCXX/copy-constructor-elim-2.cpp b/clang/test/CodeGenCXX/copy-constructor-elim-2.cpp --- a/clang/test/CodeGenCXX/copy-constructor-elim-2.cpp +++ b/clang/test/CodeGenCXX/copy-constructor-elim-2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple armv7-none-eabi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -no-enable-noundef-analysis -triple armv7-none-eabi -emit-llvm -o - %s | FileCheck %s struct A { int x; A(int); ~A(); }; A f() { return A(0); } diff --git a/clang/test/CodeGenCXX/debug-info-template-parameter.cpp b/clang/test/CodeGenCXX/debug-info-template-parameter.cpp --- a/clang/test/CodeGenCXX/debug-info-template-parameter.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-parameter.cpp @@ -1,7 +1,7 @@ // Test for DebugInfo for Defaulted parameters for C++ templates // Supported: -O0, standalone DI -// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple x86_64-linux-gnu %s -o - \ +// RUN: %clang_cc1 -std=c++14 -dwarf-version=5 -emit-llvm -triple x86_64-linux-gnu %s -o - \ // RUN: -O0 -disable-llvm-passes \ // RUN: -debug-info-kind=standalone \ // RUN: | FileCheck %s diff --git a/clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp b/clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp --- a/clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-partial-specialization.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - -debug-info-kind=standalone | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -emit-llvm -triple %itanium_abi_triple %s -o - -debug-info-kind=standalone | FileCheck %s namespace __pointer_type_imp { template struct __pointer_type1 {}; diff --git a/clang/test/CodeGenCXX/exception-spec-decay.cpp b/clang/test/CodeGenCXX/exception-spec-decay.cpp --- a/clang/test/CodeGenCXX/exception-spec-decay.cpp +++ b/clang/test/CodeGenCXX/exception-spec-decay.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions %s -triple=i686-unknown-linux -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fexceptions %s -triple=i686-unknown-linux -emit-llvm -o - | FileCheck %s typedef int Array[10]; void foo() throw (Array) { diff --git a/clang/test/CodeGenCXX/exceptions-cxx-ehsc.cpp b/clang/test/CodeGenCXX/exceptions-cxx-ehsc.cpp --- a/clang/test/CodeGenCXX/exceptions-cxx-ehsc.cpp +++ b/clang/test/CodeGenCXX/exceptions-cxx-ehsc.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fexceptions -fcxx-exceptions -fexternc-nounwind | FileCheck %s +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fexceptions -fcxx-exceptions -fexternc-nounwind -Wno-dynamic-exception-spec %stdcxx_98- | FileCheck %s namespace test1 { struct Cleanup { ~Cleanup(); }; diff --git a/clang/test/CodeGenCXX/exceptions-no-rtti.cpp b/clang/test/CodeGenCXX/exceptions-no-rtti.cpp --- a/clang/test/CodeGenCXX/exceptions-no-rtti.cpp +++ b/clang/test/CodeGenCXX/exceptions-no-rtti.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions -Wno-dynamic-exception-spec %s -triple=x86_64-apple-darwin10 -emit-llvm -o - %stdcxx_98- | FileCheck %s // CHECK: @_ZTIN5test11AE = linkonce_odr constant // CHECK: @_ZTIN5test11BE = linkonce_odr constant diff --git a/clang/test/CodeGenCXX/global-init.cpp b/clang/test/CodeGenCXX/global-init.cpp --- a/clang/test/CodeGenCXX/global-init.cpp +++ b/clang/test/CodeGenCXX/global-init.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm -fexceptions %s -o - |FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm -mframe-pointer=non-leaf %s -o - \ +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm -fexceptions %s -o - |FileCheck %s +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm -mframe-pointer=non-leaf %s -o - \ // RUN: | FileCheck -check-prefix CHECK-FP %s -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm %s -o - -fno-builtin \ +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -triple=x86_64-apple-darwin10 -emit-llvm %s -o - -fno-builtin \ // RUN: | FileCheck -check-prefix CHECK-NOBUILTIN %s struct A { diff --git a/clang/test/CodeGenCXX/no-exceptions.cpp b/clang/test/CodeGenCXX/no-exceptions.cpp --- a/clang/test/CodeGenCXX/no-exceptions.cpp +++ b/clang/test/CodeGenCXX/no-exceptions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++14 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s void g(); diff --git a/clang/test/CodeGenCXX/override-bit-field-layout.cpp b/clang/test/CodeGenCXX/override-bit-field-layout.cpp --- a/clang/test/CodeGenCXX/override-bit-field-layout.cpp +++ b/clang/test/CodeGenCXX/override-bit-field-layout.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-bit-field-layout.layout %s | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-bit-field-layout.layout %s | FileCheck %s // CHECK: Type: struct S1 // CHECK: FieldOffsets: [0, 11] diff --git a/clang/test/CodeGenCXX/override-layout.cpp b/clang/test/CodeGenCXX/override-layout.cpp --- a/clang/test/CodeGenCXX/override-layout.cpp +++ b/clang/test/CodeGenCXX/override-layout.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -w -fdump-record-layouts-simple %s > %t.layouts -// RUN: %clang_cc1 -w -fdump-record-layouts-simple %s > %t.before -// RUN: %clang_cc1 -w -DPACKED= -DALIGNED16= -fdump-record-layouts-simple -foverride-record-layout=%t.layouts %s > %t.after +// RUN: %clang_cc1 -std=c++14 -w -fdump-record-layouts-simple %s > %t.layouts +// RUN: %clang_cc1 -std=c++14 -w -fdump-record-layouts-simple %s > %t.before +// RUN: %clang_cc1 -std=c++14 -w -DPACKED= -DALIGNED16= -fdump-record-layouts-simple -foverride-record-layout=%t.layouts %s > %t.after // RUN: diff -u %t.before %t.after // RUN: FileCheck %s < %t.after diff --git a/clang/test/CodeGenCXX/reference-temporary-ms.cpp b/clang/test/CodeGenCXX/reference-temporary-ms.cpp --- a/clang/test/CodeGenCXX/reference-temporary-ms.cpp +++ b/clang/test/CodeGenCXX/reference-temporary-ms.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm %s -o - -triple=i386-pc-win32 -fms-extensions | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -emit-llvm %s -o - -triple=i386-pc-win32 -fms-extensions | FileCheck %s const int __declspec(dllexport) &Exported = 42; diff --git a/clang/test/CodeGenCXX/rtti-linkage.cpp b/clang/test/CodeGenCXX/rtti-linkage.cpp --- a/clang/test/CodeGenCXX/rtti-linkage.cpp +++ b/clang/test/CodeGenCXX/rtti-linkage.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BOTH -// RUN: %clang_cc1 -no-opaque-pointers %s -I%S -triple=x86_64-apple-darwin10 -fvisibility hidden -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH-HIDDEN -check-prefix=CHECK-BOTH %s +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BOTH +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers %s -I%S -triple=x86_64-apple-darwin10 -fvisibility hidden -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH-HIDDEN -check-prefix=CHECK-BOTH %s #include diff --git a/clang/test/Layout/ms-x86-vtordisp.cpp b/clang/test/Layout/ms-x86-vtordisp.cpp --- a/clang/test/Layout/ms-x86-vtordisp.cpp +++ b/clang/test/Layout/ms-x86-vtordisp.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fno-rtti -fms-extensions -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>&1 \ +// RUN: %clang_cc1 -std=c++14 -fno-rtti -fms-extensions -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>&1 \ // RUN: | FileCheck %s -// RUN: %clang_cc1 -fno-rtti -fms-extensions -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ +// RUN: %clang_cc1 -std=c++14 -fno-rtti -fms-extensions -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ // RUN: | FileCheck %s -check-prefix CHECK-X64 extern "C" int printf(const char *fmt, ...); diff --git a/clang/test/Modules/update-exception-spec.cpp b/clang/test/Modules/update-exception-spec.cpp --- a/clang/test/Modules/update-exception-spec.cpp +++ b/clang/test/Modules/update-exception-spec.cpp @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/update-exception-spec -emit-llvm-only %s +// RUN: %clang_cc1 -std=c++14 -fexceptions -fcxx-exceptions -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/update-exception-spec -emit-llvm-only %s #include "a.h" void use(B *p); #include "c.h" diff --git a/clang/test/OpenMP/declare_mapper_messages.cpp b/clang/test/OpenMP/declare_mapper_messages.cpp --- a/clang/test/OpenMP/declare_mapper_messages.cpp +++ b/clang/test/OpenMP/declare_mapper_messages.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -std=c++14 -verify -fopenmp -ferror-limit 100 %s // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s -// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +// RUN: %clang_cc1 -std=c++14 -verify -fopenmp-simd -ferror-limit 100 %s // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 %s diff --git a/clang/test/PCH/cxx-functions.cpp b/clang/test/PCH/cxx-functions.cpp --- a/clang/test/PCH/cxx-functions.cpp +++ b/clang/test/PCH/cxx-functions.cpp @@ -1,8 +1,8 @@ // Test this without pch. -// RUN: %clang_cc1 -include %S/cxx-functions.h -fsyntax-only -verify %s +// RUN: %clang_cc1 -include %S/cxx-functions.h -fsyntax-only -verify -std=c++14 %s -// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-functions.h -// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s +// RUN: %clang_cc1 -x c++-header -std=c++14 -emit-pch -o %t %S/cxx-functions.h +// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -std=c++14 %s // expected-no-diagnostics diff --git a/clang/test/Parser/cxx-casting.cpp b/clang/test/Parser/cxx-casting.cpp --- a/clang/test/Parser/cxx-casting.cpp +++ b/clang/test/Parser/cxx-casting.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp --- a/clang/test/Parser/cxx-class.cpp +++ b/clang/test/Parser/cxx-class.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions %s +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic -fcxx-exceptions %s // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++11 %s diff --git a/clang/test/Parser/cxx-template-argument.cpp b/clang/test/Parser/cxx-template-argument.cpp --- a/clang/test/Parser/cxx-template-argument.cpp +++ b/clang/test/Parser/cxx-template-argument.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -// RUN: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s -fdelayed-template-parsing // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -fdelayed-template-parsing // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fdelayed-template-parsing diff --git a/clang/test/Parser/cxx-template-decl.cpp b/clang/test/Parser/cxx-template-decl.cpp --- a/clang/test/Parser/cxx-template-decl.cpp +++ b/clang/test/Parser/cxx-template-decl.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp14 %s -// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp14 %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp14 -std=gnu++14 %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp14 -std=gnu++14 %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING // RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp17 -std=gnu++1z %s diff --git a/clang/test/Parser/cxx1z-nested-namespace-definition.cpp b/clang/test/Parser/cxx1z-nested-namespace-definition.cpp --- a/clang/test/Parser/cxx1z-nested-namespace-definition.cpp +++ b/clang/test/Parser/cxx1z-nested-namespace-definition.cpp @@ -1,7 +1,7 @@ // RUN: cp %s %t // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -// RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT -// RUN: %clang_cc1 -x c++ %t -DFIXIT +// RUN: not %clang_cc1 -x c++ -std=c++14 -fixit %t -Werror -DFIXIT +// RUN: %clang_cc1 -x c++ -std=c++14 %t -DFIXIT // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat namespace foo1::foo2::foo3 { diff --git a/clang/test/Sema/ms_class_layout.cpp b/clang/test/Sema/ms_class_layout.cpp --- a/clang/test/Sema/ms_class_layout.cpp +++ b/clang/test/Sema/ms_class_layout.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts %s 2>/dev/null \ +// RUN: %clang_cc1 -std=c++14 -no-opaque-pointers -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s --strict-whitespace #pragma pack(push, 8) diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp --- a/clang/test/SemaCXX/MicrosoftExtensions.cpp +++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 -// RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 -// RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2 +// RUN: %clang_cc1 -std=c++17 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 +// RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify=expected,precxx17 -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 +// RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify=expected,precxx17 -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 +// RUN: %clang_cc1 -std=c++14 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify=expected,precxx17 -fexceptions -fcxx-exceptions -DTEST2 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -fms-compatibility -verify -DTEST3 #if TEST1 @@ -119,15 +119,15 @@ // We should accept type conversion of __unaligned to non-__unaligned references typedef struct in_addr { public: - in_addr(in_addr &a) {} // expected-note {{candidate constructor not viable: expects an lvalue for 1st argument}} - in_addr(in_addr *a) {} // expected-note {{candidate constructor not viable: no known conversion from 'IN_ADDR' (aka 'in_addr') to 'in_addr *' for 1st argument}} + in_addr(in_addr &a) {} // precxx17-note {{candidate constructor not viable: expects an lvalue for 1st argument}} + in_addr(in_addr *a) {} // precxx17-note {{candidate constructor not viable: no known conversion from 'IN_ADDR' (aka 'in_addr') to 'in_addr *' for 1st argument}} } IN_ADDR; void f(IN_ADDR __unaligned *a) { IN_ADDR local_addr = *a; // FIXME: MSVC accepts the following; not sure why clang tries to // copy-construct an in_addr. - IN_ADDR local_addr2 = a; // expected-error {{no viable constructor copying variable of type 'IN_ADDR' (aka 'in_addr')}} + IN_ADDR local_addr2 = a; // precxx17-error {{no viable constructor copying variable of type 'IN_ADDR' (aka 'in_addr')}} // expected-warning@-1 {{implicit cast from type '__unaligned IN_ADDR *' (aka '__unaligned in_addr *') to type 'in_addr *' drops __unaligned qualifier}} IN_ADDR local_addr3(a); // expected-warning@-1 {{implicit cast from type '__unaligned IN_ADDR *' (aka '__unaligned in_addr *') to type 'in_addr *' drops __unaligned qualifier}} diff --git a/clang/test/SemaCXX/PR12778.cpp b/clang/test/SemaCXX/PR12778.cpp --- a/clang/test/SemaCXX/PR12778.cpp +++ b/clang/test/SemaCXX/PR12778.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wno-dynamic-exception-spec -verify %s void operator delete() throw(void*); // expected-error{{'operator delete' must have at least one parameter}} void* allocate(int __n) { diff --git a/clang/test/SemaCXX/altivec.cpp b/clang/test/SemaCXX/altivec.cpp --- a/clang/test/SemaCXX/altivec.cpp +++ b/clang/test/SemaCXX/altivec.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -target-feature +altivec -flax-vector-conversions=none -triple powerpc-unknown-unknown -fcxx-exceptions -verify %s +// RUN: %clang_cc1 -target-feature +altivec -flax-vector-conversions=none -triple powerpc-unknown-unknown -fcxx-exceptions -verify=expected,precxx17 %stdcxx_98-14 %s +// RUN: %clang_cc1 -target-feature +altivec -flax-vector-conversions=none -triple powerpc-unknown-unknown -fcxx-exceptions -verify %stdcxx_17- %s typedef int V4i __attribute__((vector_size(16))); @@ -62,7 +63,7 @@ vector float vf; vf++; - ++vi=vi; // expected-warning {{unsequenced}} + ++vi=vi; // precxx17-warning {{unsequenced}} (++vi)[1]=1; template_f(vi); } diff --git a/clang/test/SemaCXX/bool.cpp b/clang/test/SemaCXX/bool.cpp --- a/clang/test/SemaCXX/bool.cpp +++ b/clang/test/SemaCXX/bool.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion %s -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-constant-conversion \ -// RUN: -Wno-deprecated -Wdeprecated-increment-bool %s +// RUN: %clang_cc1 %stdcxx_98-14 -fsyntax-only -verify=expected,precxx17 -Wno-constant-conversion %s +// RUN: %clang_cc1 %stdcxx_98-14 -fsyntax-only -verify=expected,precxx17 -Wno-constant-conversion -Wno-deprecated -Wdeprecated-increment-bool %s +// RUN: %clang_cc1 %stdcxx_17- -fsyntax-only -verify=expected,cxx17 -Wno-constant-conversion -Wno-deprecated -Wdeprecated-increment-bool %s // Bool literals can be enum values. enum { @@ -11,8 +11,10 @@ // bool cannot be decremented, and gives a warning on increment void test(bool b) { - ++b; // expected-warning {{incrementing expression of type bool is deprecated}} - b++; // expected-warning {{incrementing expression of type bool is deprecated}} + ++b; // precxx17-warning {{incrementing expression of type bool is deprecated}} \ + cxx17-error {{ISO C++17 does not allow incrementing expression of type bool}} + b++; // precxx17-warning {{incrementing expression of type bool is deprecated}} \ + cxx17-error {{ISO C++17 does not allow incrementing expression of type bool}} --b; // expected-error {{cannot decrement expression of type bool}} b--; // expected-error {{cannot decrement expression of type bool}} diff --git a/clang/test/SemaCXX/default2.cpp b/clang/test/SemaCXX/default2.cpp --- a/clang/test/SemaCXX/default2.cpp +++ b/clang/test/SemaCXX/default2.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17 %stdcxx_11-14 %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 %stdcxx_17- %s void f(int i, int j, int k = 3); void f(int i, int j, int k); @@ -105,10 +106,10 @@ struct ZZ { static ZZ g(int = 17); - void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}} \ - // expected-note{{passing argument to parameter 'z' here}} + void f(ZZ z = g()); // precxx17-error{{no matching constructor for initialization}} \ + // precxx17-note{{passing argument to parameter 'z' here}} - ZZ(ZZ&, int = 17); // expected-note{{candidate constructor}} + ZZ(ZZ&, int = 17); // precxx17-note{{candidate constructor}} }; // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325 diff --git a/clang/test/SemaCXX/exception-spec-no-exceptions.cpp b/clang/test/SemaCXX/exception-spec-no-exceptions.cpp --- a/clang/test/SemaCXX/exception-spec-no-exceptions.cpp +++ b/clang/test/SemaCXX/exception-spec-no-exceptions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s // expected-no-diagnostics // Note that we're specifically excluding -fcxx-exceptions in the command line above. diff --git a/clang/test/SemaCXX/exceptions.cpp b/clang/test/SemaCXX/exceptions.cpp --- a/clang/test/SemaCXX/exceptions.cpp +++ b/clang/test/SemaCXX/exceptions.cpp @@ -1,6 +1,5 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++98 %s -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify=expected,precxx17 %stdcxx_98-14 %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %stdcxx_17- %s struct A; // expected-note 4 {{forward declaration of 'A'}} @@ -128,6 +127,7 @@ } } +#if __cplusplus < 201703L namespace Decay { struct A { void f() throw (A[10]); @@ -165,6 +165,7 @@ #if __cplusplus <= 199711L // expected-warning@-2 {{rvalue references are a C++11 extension}} #endif +#endif namespace HandlerInversion { struct B {}; @@ -244,14 +245,14 @@ namespace ConstVolatileThrow { struct S { - S() {} // expected-note{{candidate constructor not viable}} - S(const S &s); // expected-note{{candidate constructor not viable}} + S() {} // precxx17-note{{candidate constructor not viable}} + S(const S &s); // precxx17-note{{candidate constructor not viable}} }; typedef const volatile S CVS; void f() { - throw CVS(); // expected-error{{no matching constructor for initialization}} + throw CVS(); // precxx17-error{{no matching constructor for initialization}} } } diff --git a/clang/test/SemaCXX/expressions.cpp b/clang/test/SemaCXX/expressions.cpp --- a/clang/test/SemaCXX/expressions.cpp +++ b/clang/test/SemaCXX/expressions.cpp @@ -10,6 +10,7 @@ int i = choice(!1); } +#if __cplusplus < 201703L // rdar://8018252 void f0() { extern void f0_1(int*); @@ -19,6 +20,7 @@ #endif f0_1(&x); } +#endif namespace test1 { template void bar(T &x) { T::fail(); } diff --git a/clang/test/SemaCXX/inline.cpp b/clang/test/SemaCXX/inline.cpp --- a/clang/test/SemaCXX/inline.cpp +++ b/clang/test/SemaCXX/inline.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wpre-c++17-compat +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17-compat -std=c++17 %s -Wpre-c++17-compat // Check that we don't allow illegal uses of inline // (checking C++-only constructs here) @@ -14,5 +14,5 @@ #if __cplusplus <= 201402L inline int a; // expected-warning{{inline variables are a C++17 extension}} #else -inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}} +inline int a; // cxx17-compat-warning{{inline variables are incompatible with C++ standards before C++17}} #endif diff --git a/clang/test/SemaCXX/libstdcxx_is_pod_hack.cpp b/clang/test/SemaCXX/libstdcxx_is_pod_hack.cpp --- a/clang/test/SemaCXX/libstdcxx_is_pod_hack.cpp +++ b/clang/test/SemaCXX/libstdcxx_is_pod_hack.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // This is a test for an egregious hack in Clang that works around // issues with GCC's evolution. libstdc++ 4.2.x uses __is_pod as an diff --git a/clang/test/SemaCXX/linkage2.cpp b/clang/test/SemaCXX/linkage2.cpp --- a/clang/test/SemaCXX/linkage2.cpp +++ b/clang/test/SemaCXX/linkage2.cpp @@ -173,7 +173,10 @@ }; } template void foo() {} - template void bar() {} // expected-note {{candidate function}} + template void bar() {} +#if __cplusplus < 201703L + // expected-note@-2 {{candidate function}} +#endif inline void *g() { struct L { }; @@ -181,7 +184,10 @@ // InternalLinkage in c++11) and VisibleNoLinkage. The correct answer is // NoLinkage in both cases. This means that using foo as a template // argument should fail. - return reinterpret_cast(bar), foo >); // expected-error {{reinterpret_cast cannot resolve overloaded function 'bar' to type 'void *}} + return reinterpret_cast(bar), foo >); +#if __cplusplus < 201703L + // expected-error@-2 {{reinterpret_cast cannot resolve overloaded function 'bar' to type 'void *}} +#endif } void h() { g(); diff --git a/clang/test/SemaCXX/member-pointer.cpp b/clang/test/SemaCXX/member-pointer.cpp --- a/clang/test/SemaCXX/member-pointer.cpp +++ b/clang/test/SemaCXX/member-pointer.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s struct A {}; enum B { Dummy }; @@ -14,7 +14,10 @@ int A::*pdi1; int (::A::*pdi2); int (A::*pfi)(int); -void (*A::*ppfie)() throw(); // expected-error {{exception specifications are not allowed beyond a single level of indirection}} +void (*A::*ppfie)() throw(); +#if __cplusplus < 201703L +// expected-error@-2 {{exception specifications are not allowed beyond a single level of indirection}} +#endif int B::*pbi; #if __cplusplus <= 199711L // C++03 or earlier modes diff --git a/clang/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp b/clang/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp --- a/clang/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp +++ b/clang/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp @@ -62,6 +62,7 @@ nylinkedlist w; // expected-error{{unknown type name 'nylinkedlist'; did you mean 'realstd::mylinkedlist'?}} } +#if __cplusplus < 201703L // Test case from http://llvm.org/bugs/show_bug.cgi?id=10318 namespace llvm { template class GraphWriter {}; // expected-note 3{{declared here}} @@ -73,6 +74,7 @@ (void)new llvm::GraphWriter; // expected-error {{use of class template 'llvm::GraphWriter' requires template arguments}} (void)new llvm::Graphwriter; // expected-error {{no template named 'Graphwriter' in namespace 'llvm'; did you mean 'GraphWriter'?}} } +#endif // If namespace prefixes and character edits have the same weight, correcting // "fimish" to "N::famish" would have the same edit distance as correcting diff --git a/clang/test/SemaCXX/static-data-member.cpp b/clang/test/SemaCXX/static-data-member.cpp --- a/clang/test/SemaCXX/static-data-member.cpp +++ b/clang/test/SemaCXX/static-data-member.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -w %s +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -w %s struct ABC { static double a; diff --git a/clang/test/SemaCXX/type-definition-in-specifier.cpp b/clang/test/SemaCXX/type-definition-in-specifier.cpp --- a/clang/test/SemaCXX/type-definition-in-specifier.cpp +++ b/clang/test/SemaCXX/type-definition-in-specifier.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify %s +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify -std=c++14 %s struct S0; struct S1; diff --git a/clang/test/SemaCXX/user-defined-conversions.cpp b/clang/test/SemaCXX/user-defined-conversions.cpp --- a/clang/test/SemaCXX/user-defined-conversions.cpp +++ b/clang/test/SemaCXX/user-defined-conversions.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17 -std=c++14 %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected -std=c++17 %s struct X { operator bool(); }; @@ -69,7 +70,7 @@ } struct X1 { - X1(X1&); // expected-note{{candidate constructor not viable: expects an lvalue for 1st argument}} + X1(X1&); // precxx17-note{{candidate constructor not viable: expects an lvalue for 1st argument}} }; struct X2 { @@ -80,7 +81,7 @@ float &f(...); void g(X2 b) { - int &ir = f(b); // expected-error{{no viable constructor copying parameter of type 'X1'}} + int &ir = f(b); // precxx17-error{{no viable constructor copying parameter of type 'X1'}} } namespace rdar10202900 { diff --git a/clang/test/SemaCXX/warn-new-overaligned-3.cpp b/clang/test/SemaCXX/warn-new-overaligned-3.cpp --- a/clang/test/SemaCXX/warn-new-overaligned-3.cpp +++ b/clang/test/SemaCXX/warn-new-overaligned-3.cpp @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned %s -isystem %S/Inputs -verify +// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned %s -isystem %S/Inputs -verify=precxx17 %stdcxx_11-14 +// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned %s -isystem %S/Inputs -verify %stdcxx_17- + +// expected-no-diagnostics // This test ensures that we still get the warning even if we #include // where the header here simulates . @@ -16,8 +19,8 @@ void helper() { Test t; - new Test; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} - new Test[10]; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test[10]; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} } } diff --git a/clang/test/SemaCXX/warn-new-overaligned.cpp b/clang/test/SemaCXX/warn-new-overaligned.cpp --- a/clang/test/SemaCXX/warn-new-overaligned.cpp +++ b/clang/test/SemaCXX/warn-new-overaligned.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned -verify %s +// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned -verify=precxx17 -std=c++14 %s +// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned -verify=cxx17 -std=c++17 %s namespace test1 { struct Test { @@ -12,8 +13,8 @@ void helper() { Test t; - new Test; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} - new Test[10]; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test[10]; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} } } @@ -25,8 +26,8 @@ void helper() { Test t; - new Test; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} - new Test[10]; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test[10]; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} } } @@ -38,7 +39,8 @@ } __attribute__((aligned(256))); void* operator new(unsigned long) { - return 0; // expected-warning {{'operator new' should not return a null pointer unless it is declared 'throw()'}} + return 0; // precxx17-warning {{'operator new' should not return a null pointer unless it is declared 'throw()'}} \ + cxx17-warning {{'operator new' should not return a null pointer unless it is declared 'throw()' or 'noexcept'}} } SeparateCacheLines high_contention_data[10]; @@ -47,7 +49,7 @@ void helper() { Test t; new Test; - new Test[10]; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test[10]; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} } } @@ -59,7 +61,8 @@ } __attribute__((aligned(256))); void* operator new[](unsigned long) { - return 0; // expected-warning {{'operator new[]' should not return a null pointer unless it is declared 'throw()'}} + return 0; // precxx17-warning {{'operator new[]' should not return a null pointer unless it is declared 'throw()'}} \ + cxx17-warning {{'operator new[]' should not return a null pointer unless it is declared 'throw()' or 'noexcept'}} } SeparateCacheLines high_contention_data[10]; @@ -67,7 +70,7 @@ void helper() { Test t; - new Test; // expected-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} + new Test; // precxx17-warning {{type 'Test' requires 256 bytes of alignment and the default allocator only guarantees}} new Test[10]; } } diff --git a/clang/test/SemaCXX/writable-strings-deprecated.cpp b/clang/test/SemaCXX/writable-strings-deprecated.cpp --- a/clang/test/SemaCXX/writable-strings-deprecated.cpp +++ b/clang/test/SemaCXX/writable-strings-deprecated.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -DWARNING +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s -DWARNING // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s -DWARNING // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated-writable-strings -verify %s // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated -Wdeprecated-increment-bool -verify %s diff --git a/clang/test/SemaSYCL/zero-length-arrays.cpp b/clang/test/SemaSYCL/zero-length-arrays.cpp --- a/clang/test/SemaSYCL/zero-length-arrays.cpp +++ b/clang/test/SemaSYCL/zero-length-arrays.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsycl-is-device -triple spir64 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsycl-is-device -triple spir64 -fsyntax-only -verify -std=c++14 %s // // This test checks if compiler reports compilation error on an attempt to use // a zero-length array inside device code. diff --git a/clang/test/SemaTemplate/class-template-id.cpp b/clang/test/SemaTemplate/class-template-id.cpp --- a/clang/test/SemaTemplate/class-template-id.cpp +++ b/clang/test/SemaTemplate/class-template-id.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s template struct A { }; typedef A A_int; diff --git a/clang/test/SemaTemplate/constructor-template.cpp b/clang/test/SemaTemplate/constructor-template.cpp --- a/clang/test/SemaTemplate/constructor-template.cpp +++ b/clang/test/SemaTemplate/constructor-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s diff --git a/clang/test/SemaTemplate/explicit-instantiation.cpp b/clang/test/SemaTemplate/explicit-instantiation.cpp --- a/clang/test/SemaTemplate/explicit-instantiation.cpp +++ b/clang/test/SemaTemplate/explicit-instantiation.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions %s // RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions -std=c++14 %s template void *; // expected-error{{expected unqualified-id}} diff --git a/clang/test/SemaTemplate/instantiate-exception-spec.cpp b/clang/test/SemaTemplate/instantiate-exception-spec.cpp --- a/clang/test/SemaTemplate/instantiate-exception-spec.cpp +++ b/clang/test/SemaTemplate/instantiate-exception-spec.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify %s -DERRORS -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -emit-llvm-only %s +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify -std=c++14 %s -DERRORS +// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -emit-llvm-only -std=c++14 %s #ifdef ERRORS template void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}} diff --git a/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp b/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp --- a/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp +++ b/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template struct X1 { diff --git a/clang/test/SemaTemplate/instantiation-default-2.cpp b/clang/test/SemaTemplate/instantiation-default-2.cpp --- a/clang/test/SemaTemplate/instantiation-default-2.cpp +++ b/clang/test/SemaTemplate/instantiation-default-2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s template struct Constant; // expected-note{{template parameter is declared here}} \ // FIXME: bad location expected-error{{a non-type template parameter cannot have type 'float'}} diff --git a/clang/test/SemaTemplate/temp_arg.cpp b/clang/test/SemaTemplate/temp_arg.cpp --- a/clang/test/SemaTemplate/temp_arg.cpp +++ b/clang/test/SemaTemplate/temp_arg.cpp @@ -1,8 +1,12 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17 %stdcxx_98-14 %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 %stdcxx_17- %s template class TT> - class A; // expected-note 3 {{template is declared here}} + class A; // precxx17-note 3 {{template is declared here}} \ + cxx17-note 2 {{template is declared here}} \ + cxx17-note {{candidate template ignored: couldn't infer template argument 'T'}} \ + cxx17-note {{candidate function template not viable: requires 1 argument, but 0 were provided}} template class X; @@ -10,7 +14,8 @@ A *a2; // expected-error{{too many template arguments for class template 'A'}} A *a3; // expected-error{{too few template arguments for class template 'A'}} -A a4; // expected-error{{use of class template 'A' requires template arguments}} +A a4; // precxx17-error{{use of class template 'A' requires template arguments}} \ + cxx17-error{{no viable constructor or deduction guide for deduction of template arguments of 'A'}} namespace test0 { template class foo {}; diff --git a/clang/test/SemaTemplate/temp_arg_template.cpp b/clang/test/SemaTemplate/temp_arg_template.cpp --- a/clang/test/SemaTemplate/temp_arg_template.cpp +++ b/clang/test/SemaTemplate/temp_arg_template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s diff --git a/clang/test/SemaTemplate/typename-specifier-3.cpp b/clang/test/SemaTemplate/typename-specifier-3.cpp --- a/clang/test/SemaTemplate/typename-specifier-3.cpp +++ b/clang/test/SemaTemplate/typename-specifier-3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // PR4364 template struct a { // expected-note {{here}} diff --git a/clang/unittests/AST/ASTTraverserTest.cpp b/clang/unittests/AST/ASTTraverserTest.cpp --- a/clang/unittests/AST/ASTTraverserTest.cpp +++ b/clang/unittests/AST/ASTTraverserTest.cpp @@ -280,7 +280,7 @@ TEST(Traverse, IgnoreUnlessSpelledInSourceVars) { - auto AST = buildASTFromCode(R"cpp( + auto AST = buildASTFromCodeWithArgs(R"cpp( struct String { @@ -346,7 +346,7 @@ } } -)cpp"); +)cpp", {"-std=c++14"}); { auto FN = @@ -715,7 +715,7 @@ TEST(Traverse, IgnoreUnlessSpelledInSourceReturns) { - auto AST = buildASTFromCode(R"cpp( + auto AST = buildASTFromCodeWithArgs(R"cpp( struct A { @@ -784,7 +784,7 @@ return c; } -)cpp"); +)cpp", {"-std=c++14"}); auto getFunctionNode = [&AST](const std::string &name) { auto BN = ast_matchers::match(functionDecl(hasName(name)).bind("fn"), diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -563,6 +563,26 @@ self.config.substitutions.append( ('%target_itanium_abi_host_triple', '')) + # Many tests work across many language dialects. We provide substitutions + # conveniently try every dialect with LIT_CLANG_STD_GROUP. + clang_std_group = int(os.environ.get('LIT_CLANG_STD_GROUP', '0')) + clang_std_values = ('98', '11', '14', '17', '20', '2b') + def add_stdcxx(s): + t = s[8:] + if t.endswith('-'): + t += '2b' + l = clang_std_values.index(t[0:2]) + h = clang_std_values.index(t[3:5]) + # Let LIT_CLANG_STD_GROUP=0 pick the highest value (likely the most relevant + # dialect). + l = h - clang_std_group % (h-l+1) + self.config.substitutions.append((s, '-std=c++' + clang_std_values[l])) + + add_stdcxx('%stdcxx_98-14') + add_stdcxx('%stdcxx_98-') + add_stdcxx('%stdcxx_11-14') + add_stdcxx('%stdcxx_17-') + # FIXME: Find nicer way to prohibit this. def prefer(this, to): return '''\"*** Do not use '%s' in tests, use '%s'. ***\"''' % (