diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-08-20 21:03:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-08-20 21:03:30 +0000 |
commit | 6aa46a19c56750e17f7acedc47d95111fd2dcd5d (patch) | |
tree | e34ae427575758352981df5376a2975e2dbcd403 /test | |
parent | ffe56ea4c355b82c6fdbed4befc7fe3b956e35a2 (diff) |
Notes
Diffstat (limited to 'test')
42 files changed, 567 insertions, 144 deletions
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp index 3d4b92518810b..072f5e74aabbc 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify -Wc++1z-extensions %s -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++1z-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -Wc++17-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++17-extensions %s struct [[nodiscard]] S {}; S get_s(); @@ -23,7 +23,7 @@ void f() { } #ifdef EXT -// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}} +// expected-warning@4 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@8 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@11 {{use of the 'nodiscard' attribute is a C++17 extension}} #endif diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp index a627d8331a746..551df38a81003 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++1z -Wc++1z-extensions -verify %s -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++1z-extensions -verify -DEXT %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s static_assert(__has_cpp_attribute(maybe_unused) == 201603, ""); @@ -20,7 +20,7 @@ void f() { } #ifdef EXT -// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++1z extension}} +// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++17 extension}} #endif diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp index 055f40f98f660..fbca6635ec189 100644 --- a/test/CXX/drs/dr0xx.cpp +++ b/test/CXX/drs/dr0xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple namespace dr1 { // dr1: no namespace X { extern "C" void dr1_f(int a = 1); } @@ -276,9 +276,9 @@ namespace dr23 { // dr23: yes namespace dr25 { // dr25: yes struct A { - void f() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} }; - void (A::*f)() throw (int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*f)() throw (int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*g)() throw () = f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -286,7 +286,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*g2)() throw () = 0; - void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*i)() throw () = &A::f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -294,7 +294,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*i2)() throw () = 0; - void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void x() { g2 = f; #if __cplusplus <= 201402L @@ -941,7 +941,7 @@ namespace dr84 { // dr84: yes }; A a; // Cannot use B(C) / operator C() pair to construct the B from the B temporary - // here. In C++1z, we initialize the B object directly using 'A::operator B()'. + // here. In C++17, we initialize the B object directly using 'A::operator B()'. B b = a; #if __cplusplus <= 201402L // expected-error@-2 {{no viable}} @@ -1033,14 +1033,14 @@ namespace dr91 { // dr91: yes } namespace dr92 { // dr92: 4 c++17 - void f() throw(int, float); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} - void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int, float); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} + void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{target exception specification is not superset of source}} #else // expected-warning@-4 {{target exception specification is not superset of source}} #endif - void (*q)() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (*q)() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (**pp)() throw() = &q; #if __cplusplus <= 201402L // expected-error@-2 {{exception specifications are not allowed}} @@ -1064,7 +1064,7 @@ namespace dr92 { // dr92: 4 c++17 // expected-error@-2 {{not implicitly convertible}} #endif - template<void() throw(int)> struct Y {}; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + template<void() throw(int)> struct Y {}; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} Y<&h> yp; // ok } diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp index 64ba3be2a618d..f193c8e024fbc 100644 --- a/test/CXX/drs/dr13xx.cpp +++ b/test/CXX/drs/dr13xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors __extension__ typedef __SIZE_TYPE__ size_t; @@ -124,7 +124,7 @@ namespace dr1315 { // dr1315: partial namespace dr1330 { // dr1330: 4 c++11 // exception-specifications are parsed in a context where the class is complete. struct A { - void f() throw(T) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -134,7 +134,7 @@ namespace dr1330 { // dr1330: 4 c++11 #endif }; - void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} void (A::*af2)() throw() = &A::f; // expected-error-re {{{{not superset|different exception spec}}}} #if __cplusplus >= 201103L @@ -144,7 +144,7 @@ namespace dr1330 { // dr1330: 4 c++11 // Likewise, they're instantiated separately from an enclosing class template. template<typename U> struct B { - void f() throw(T, typename U::type) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T, typename U::type) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -161,7 +161,7 @@ namespace dr1330 { // dr1330: 4 c++11 static const int value = true; }; - void (B<P>::*bpf1)() throw(B<P>::T, int) = &B<P>::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B<P>::*bpf1)() throw(B<P>::T, int) = &B<P>::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus < 201103L // expected-error@-2 {{not superset}} // FIXME: We only delay instantiation in C++11 onwards. In C++98, something @@ -172,7 +172,7 @@ namespace dr1330 { // dr1330: 4 c++11 // the "T has not yet been instantiated" error here, rather than giving // confusing errors later on. #endif - void (B<P>::*bpf2)() throw(int) = &B<P>::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B<P>::*bpf2)() throw(int) = &B<P>::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{not superset}} #else @@ -194,7 +194,7 @@ namespace dr1330 { // dr1330: 4 c++11 template<typename T> int f() throw(typename T::error) { return 0; } // expected-error 1-4{{prior to '::'}} expected-note 0-1{{prior to '::'}} expected-note 0-1{{requested here}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif // An exception-specification is needed even if the function is only used in // an unevaluated operand. @@ -203,7 +203,7 @@ namespace dr1330 { // dr1330: 4 c++11 decltype(f<char>()) f2; // expected-note {{instantiation of}} bool f3 = noexcept(f<float>()); // expected-note {{instantiation of}} #endif - // In C++1z onwards, substituting explicit template arguments into the + // In C++17 onwards, substituting explicit template arguments into the // function type substitutes into the exception specification (because it's // part of the type). In earlier languages, we don't notice there's a problem // until we've already started to instantiate. @@ -217,7 +217,7 @@ namespace dr1330 { // dr1330: 4 c++11 template<typename T> struct C { C() throw(typename T::type); // expected-error 1-2{{prior to '::'}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif }; struct D : C<void> {}; // ok diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp index f5395cfe183db..d62ed9f0d36dc 100644 --- a/test/CXX/drs/dr1xx.cpp +++ b/test/CXX/drs/dr1xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors namespace dr100 { // dr100: yes template<const char *> struct A {}; // expected-note 0-1{{declared here}} @@ -313,7 +313,7 @@ namespace dr126 { // dr126: no virtual void z() throw(long); // expected-error {{more lax}} }; #else - void f() throw(int); // expected-error {{ISO C++1z does not allow}} expected-note {{use 'noexcept}} + void f() throw(int); // expected-error {{ISO C++17 does not allow}} expected-note {{use 'noexcept}} #endif } diff --git a/test/CXX/drs/dr20xx.cpp b/test/CXX/drs/dr20xx.cpp index b97a9a46bc85a..5819c319fd54e 100644 --- a/test/CXX/drs/dr20xx.cpp +++ b/test/CXX/drs/dr20xx.cpp @@ -10,7 +10,7 @@ #define static_assert(...) _Static_assert(__VA_ARGS__) #endif -namespace dr2094 { // dr2094: 5.0 +namespace dr2094 { // dr2094: 5 struct A { int n; }; struct B { volatile int n; }; static_assert(__is_trivially_copyable(volatile int), ""); diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp index a5677a125a007..4e745ef2f4d02 100644 --- a/test/CXX/drs/dr2xx.cpp +++ b/test/CXX/drs/dr2xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // PR13819 -- __SIZE_TYPE__ is incompatible. typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}} @@ -984,7 +984,7 @@ namespace dr289 { // dr289: yes namespace dr294 { // dr294: no void f() throw(int); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif int main() { (void)static_cast<void (*)() throw()>(f); // FIXME: ill-formed in C++14 and before @@ -1001,13 +1001,13 @@ namespace dr294 { // dr294: no #endif (void)static_cast<void (*)() throw(int)>(f); // FIXME: ill-formed in C++14 and before #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void (*p)() throw() = f; // expected-error-re {{{{not superset|different exception specification}}}} void (*q)() throw(int) = f; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif } } diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp index a55bb91be558b..1a5976eadaffc 100644 --- a/test/CXX/drs/dr4xx.cpp +++ b/test/CXX/drs/dr4xx.cpp @@ -1,7 +1,7 @@ // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets. __extension__ typedef __SIZE_TYPE__ size_t; @@ -507,16 +507,16 @@ namespace dr437 { // dr437: sup 1308 struct S { void f() throw(S); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void g() throw(T<S>); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U; void h() throw(U); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U {}; }; @@ -1202,7 +1202,7 @@ namespace dr495 { // dr495: 3.5 long n2 = s2; } -namespace dr496 { // dr496: sup dr2094 +namespace dr496 { // dr496: sup 2094 struct A { int n; }; struct B { volatile int n; }; int check1[ __is_trivially_copyable(const int) ? 1 : -1]; diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp index 97b40b8b7c263..5122398b7ca3e 100644 --- a/test/CXX/drs/dr5xx.cpp +++ b/test/CXX/drs/dr5xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: This is included to avoid a diagnostic with no source location // pointing at the implicit operator new. We can't match such a diagnostic @@ -966,7 +966,7 @@ namespace dr595 { // dr595: dup 1330 template<class T> struct X { void f() throw(T) {} #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif }; struct S { diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index 8c4f36c0ff740..ad6086835876c 100644 --- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s struct pr12960 { int begin; @@ -125,7 +125,7 @@ void g() { }; for (auto a : Differ()) #if __cplusplus <= 201402L - // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++1z extension}} + // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++17 extension}} // expected-note@-6 {{selected 'begin' function with iterator type 'int *'}} // expected-note@-6 {{selected 'end' function with iterator type 'null_t'}} #endif diff --git a/test/CodeCompletion/uninstantiated_params.cpp b/test/CodeCompletion/uninstantiated_params.cpp new file mode 100644 index 0000000000000..57a520dd5712e --- /dev/null +++ b/test/CodeCompletion/uninstantiated_params.cpp @@ -0,0 +1,13 @@ +template <class T> +struct unique_ptr { + typedef T* pointer; + + void reset(pointer ptr = pointer()); +}; + +void test() { + unique_ptr<int> x; + x. + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: [#void#]reset({#<#unique_ptr<int>::pointer ptr = pointer()#>#}) +} diff --git a/test/CodeGen/arm-float-helpers.c b/test/CodeGen/arm-float-helpers.c new file mode 100644 index 0000000000000..30363304bcf9c --- /dev/null +++ b/test/CodeGen/arm-float-helpers.c @@ -0,0 +1,233 @@ +// REQUIRES: arm-registered-target +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | FileCheck %s + +// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The +// floating-point helper functions to always use the base AAPCS (soft-float) +// calling convention. +// +// These helper functions such as __aeabi_fadd are not explicitly called by +// clang, instead they are generated by the ARMISelLowering when they are +// needed; clang relies on llvm to use the base AAPCS. +// +// In this test we check that clang is not directly calling the __aeabi_ +// functions. We rely on llvm to test that the base AAPCS is used for any +// __aeabi_ function from 4.1.2 that is used. +// +// When compiled to an object file with -mfloat-abi=soft each function F +// below should result in a call to __aeabi_F. If clang is changed to call any +// of these functions directly the test will need to be altered to check that +// arm_aapcscc is used. +// +// Note that it is only the functions in 4.1.2 that must use the base AAPCS, +// other runtime functions such as the _Complex helper routines are not covered. + +float fadd(float a, float b) { return a + b; } +// CHECK-LABEL: define float @fadd(float %a, float %b) +// CHECK-NOT: __aeabi_fadd +// CHECK: %add = fadd float {{.*}}, {{.*}} + +float fdiv(float a, float b) { return a / b; } +// CHECK-LABEL: define float @fdiv(float %a, float %b) +// CHECK-NOT: __aeabi_fdiv +// CHECK: %div = fdiv float {{.*}}, {{.*}} + +float fmul(float a, float b) { return a * b; } +// CHECK-LABEL: define float @fmul(float %a, float %b) +// CHECK-NOT: __aeabi_fmul +// CHECK: %mul = fmul float {{.*}}, {{.*}} + +float fsub(float a, float b) { return a - b; } +// CHECK-LABEL: define float @fsub(float %a, float %b) +// CHECK-NOT: __aeabi_fsub +// CHECK: %sub = fsub float {{.*}}, {{.*}} + +int fcmpeq(float a, float b) { return a == b; } +// CHECK-LABEL: define i32 @fcmpeq(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpeq +// CHECK: %cmp = fcmp oeq float {{.*}}, {{.*}} + +int fcmplt(float a, float b) { return a < b; } +// CHECK-LABEL: define i32 @fcmplt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmplt +// CHECK: %cmp = fcmp olt float {{.*}}, {{.*}} + +int fcmple(float a, float b) { return a <= b; } +// CHECK-LABEL: define i32 @fcmple(float %a, float %b) +// CHECK-NOT: __aeabi_fcmple +// CHECK: %cmp = fcmp ole float {{.*}}, {{.*}} + +int fcmpge(float a, float b) { return a >= b; } +// CHECK-LABEL: define i32 @fcmpge(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpge +// CHECK: %cmp = fcmp oge float {{.*}}, {{.*}} + +int fcmpgt(float a, float b) { return a > b; } +// CHECK-LABEL: define i32 @fcmpgt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpgt +// CHECK: %cmp = fcmp ogt float {{.*}}, {{.*}} + +int fcmpun(float a, float b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @fcmpun(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpun +// CHECK: %cmp = fcmp uno double %conv, %conv1 + +double dadd(double a, double b) { return a + b; } +// CHECK-LABEL: define double @dadd(double %a, double %b) +// CHECK-NOT: __aeabi_dadd +// CHECK: %add = fadd double {{.*}}, {{.*}} + +double ddiv(double a, double b) { return a / b; } +// CHECK-LABEL: define double @ddiv(double %a, double %b) +// CHECK-NOT: __aeabi_ddiv +// CHECK: %div = fdiv double {{.*}}, {{.*}} + +double dmul(double a, double b) { return a * b; } +// CHECK-LABEL: define double @dmul(double %a, double %b) +// CHECK-NOT: __aeabi_dmul +// CHECK: %mul = fmul double {{.*}}, {{.*}} + +double dsub(double a, double b) { return a - b; } +// CHECK-LABEL: define double @dsub(double %a, double %b) +// CHECK-NOT: __aeabi_dsub +// CHECK: %sub = fsub double {{.*}}, {{.*}} + +int dcmpeq(double a, double b) { return a == b; } +// CHECK-LABEL: define i32 @dcmpeq(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpeq +// CHECK: %cmp = fcmp oeq double {{.*}}, {{.*}} + +int dcmplt(double a, double b) { return a < b; } +// CHECK-LABEL: define i32 @dcmplt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmplt +// CHECK: %cmp = fcmp olt double {{.*}}, {{.*}} + +int dcmple(double a, double b) { return a <= b; } +// CHECK-LABEL: define i32 @dcmple(double %a, double %b) +// CHECK-NOT: __aeabi_dcmple +// CHECK: %cmp = fcmp ole double {{.*}}, {{.*}} + +int dcmpge(double a, double b) { return a >= b; } +// CHECK-LABEL: define i32 @dcmpge(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpge +// CHECK: %cmp = fcmp oge double {{.*}}, {{.*}} + +int dcmpgt(double a, double b) { return a > b; } +// CHECK-LABEL: define i32 @dcmpgt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpgt +// CHECK: %cmp = fcmp ogt double {{.*}}, {{.*}} + +int dcmpun(double a, double b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @dcmpun(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpun +// CHECK: %cmp = fcmp uno double {{.*}}, {{.*}} + +int d2iz(double a) { return (int)a; } +// CHECK-LABEL: define i32 @d2iz(double %a) +// CHECK-NOT: __aeabi_d2iz +// CHECK: %conv = fptosi double {{.*}} to i32 + +unsigned int d2uiz(double a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @d2uiz(double %a) +// CHECK-NOT: __aeabi_d2uiz +// CHECK: %conv = fptoui double {{.*}} to i32 + +long long d2lz(double a) { return (long long)a; } +// CHECK-LABEL: define i64 @d2lz(double %a) +// CHECK-NOT: __aeabi_d2lz +// CHECK: %conv = fptosi double {{.*}} to i64 + +unsigned long long d2ulz(double a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @d2ulz(double %a) +// CHECK-NOT: __aeabi_d2ulz +// CHECK: %conv = fptoui double {{.*}} to i64 + +int f2iz(float a) { return (int)a; } +// CHECK-LABEL: define i32 @f2iz(float %a) +// CHECK-NOT: __aeabi_f2iz +// CHECK: %conv = fptosi float {{.*}} to i32 + +unsigned int f2uiz(float a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @f2uiz(float %a) +// CHECK-NOT: __aeabi_f2uiz +// CHECK: %conv = fptoui float {{.*}} to i32 + +long long f2lz(float a) { return (long long)a; } +// CHECK-LABEL: define i64 @f2lz(float %a) +// CHECK-NOT: __aeabi_f2lz +// CHECK: %conv = fptosi float {{.*}} to i64 + +unsigned long long f2ulz(float a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @f2ulz(float %a) +// CHECK-NOT: __aeabi_f2ulz +// CHECK: %conv = fptoui float {{.*}} to i64 + +float d2f(double a) { return (float)a; } +// CHECK-LABEL: define float @d2f(double %a) +// CHECK-NOT: __aeabi_d2f +// CHECK: %conv = fptrunc double {{.*}} to float + +double f2d(float a) { return (double)a; } +// CHECK-LABEL: define double @f2d(float %a) +// CHECK-NOT: __aeabi_f2d +// CHECK: %conv = fpext float {{.*}} to double + +double i2d(int a) { return (double)a; } +// CHECK-LABEL: define double @i2d(i32 %a) +// CHECK-NOT: __aeabi_i2d +// CHECK: %conv = sitofp i32 {{.*}} to double + +double ui2d(unsigned int a) { return (double)a; } +// CHECK-LABEL: define double @ui2d(i32 %a) +// CHECK-NOT: __aeabi_ui2d +// CHECK: %conv = uitofp i32 {{.*}} to double + +double l2d(long long a) { return (double)a; } +// CHECK-LABEL: define double @l2d(i64 %a) +// CHECK-NOT: __aeabi_l2d +// CHECK: %conv = sitofp i64 {{.*}} to double + +double ul2d(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define double @ul2d(i64 %a) +// CHECK-NOT: __aeabi_ul2d +// CHECK: %conv = uitofp i64 {{.*}} to double + +float i2f(int a) { return (int)a; } +// CHECK-LABEL: define float @i2f(i32 %a) +// CHECK-NOT: __aeabi_i2f +// CHECK: %conv = sitofp i32 {{.*}} to float + +float ui2f(unsigned int a) { return (unsigned int)a; } +// CHECK-LABEL: define float @ui2f(i32 %a) +// CHECK-NOT: __aeabi_ui2f +// CHECK: %conv = uitofp i32 {{.*}} to float + +float l2f(long long a) { return (long long)a; } +// CHECK-LABEL: define float @l2f(i64 %a) +// CHECK-NOT: __aeabi_l2f +// CHECK: %conv = sitofp i64 {{.*}} to float + +float ul2f(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define float @ul2f(i64 %a) +// CHECK-NOT: __aeabi_ul2f +// CHECK: %conv = uitofp i64 {{.*}} to float + +// Functions in section 4.1.2 not used by llvm and don't easily map directly to +// C source code. +// cfcmpeq +// cfcmple +// cfrcmple +// cdcmpeq +// cdcmple +// cdrcmple +// frsub +// drsub diff --git a/test/CodeGen/complex-math.c b/test/CodeGen/complex-math.c index 96c7ad9cdbc93..8792ca14b9d88 100644 --- a/test/CodeGen/complex-math.c +++ b/test/CodeGen/complex-math.c @@ -2,7 +2,8 @@ // RUN: %clang_cc1 %s -O1 -emit-llvm -triple x86_64-pc-win64 -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC -// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARM +// RUN %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabi -o - | FileCheck %s --check-prefix=ARM +// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARMHF // RUN: %clang_cc1 %s -O1 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K float _Complex add_float_rr(float a, float b) { @@ -476,8 +477,15 @@ _Bool ne_float_cc(float _Complex a, float _Complex b) { // Check that the libcall will obtain proper calling convention on ARM _Complex double foo(_Complex double a, _Complex double b) { + // These functions are not defined as floating point helper functions in + // Run-time ABI for the ARM architecture document so they must not always + // use the base AAPCS. + // ARM-LABEL: @foo( - // ARM: call arm_aapcscc { double, double } @__muldc3 + // ARM: call void { double, double } @__muldc3 + + // ARMHF-LABEL: @foo( + // ARMHF: call { double, double } @__muldc3 // ARM7K-LABEL: @foo( // ARM7K: call { double, double } @__muldc3 diff --git a/test/CodeGen/mips-aggregate-arg.c b/test/CodeGen/mips-aggregate-arg.c deleted file mode 100644 index ccf30df7c22a0..0000000000000 --- a/test/CodeGen/mips-aggregate-arg.c +++ /dev/null @@ -1,38 +0,0 @@ -// RUN: %clang_cc1 -triple mipsel-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32-N64 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n64 | FileCheck -check-prefix=N32-N64 %s - -struct t1 { - char t1[10]; -}; - -struct t2 { - char t2[20]; -}; - -struct t3 { - char t3[65]; -}; - -extern struct t1 g1; -extern struct t2 g2; -extern struct t3 g3; -extern void f1(struct t1); -extern void f2(struct t2); -extern void f3(struct t3); - -void f() { - -// O32: call void @f1(i32 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// O32: call void @f2(%struct.t2* byval align 4 %{{.*}}) -// O32: call void @f3(%struct.t3* byval align 4 %{{.*}}) - -// N32-N64: call void @f1(i64 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// N32-N64: call void @f2(i64 inreg %{{[0-9]+}}, i64 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}) -// N32-N64: call void @f3(%struct.t3* byval align 8 %{{.*}}) - - f1(g1); - f2(g2); - f3(g3); -} - diff --git a/test/CodeGen/mips-madd4.c b/test/CodeGen/mips-madd4.c new file mode 100644 index 0000000000000..bc7bb593f95d6 --- /dev/null +++ b/test/CodeGen/mips-madd4.c @@ -0,0 +1,87 @@ +// REQUIRES: mips-registered-target +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 %s -o -| FileCheck %s -check-prefix=MADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 %s -o -| FileCheck %s -check-prefix=NOMADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=MADD4-NONAN +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=NOMADD4-NONAN + +float madd_s (float f, float g, float h) +{ + return (f * g) + h; +} +// MADD4: madd.s +// NOMADD4: mul.s +// NOMADD4: add.s + +float msub_s (float f, float g, float h) +{ + return (f * g) - h; +} +// MADD4: msub.s +// NOMADD4: mul.s +// NOMADD4: sub.s + +double madd_d (double f, double g, double h) +{ + return (f * g) + h; +} +// MADD4: madd.d +// NOMADD4: mul.d +// NOMADD4: add.d + +double msub_d (double f, double g, double h) +{ + return (f * g) - h; +} +// MADD4: msub.d +// NOMADD4: mul.d +// NOMADD4: sub.d + + +float nmadd_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: add.s +// NOMADD4-NONAN: sub.s + +float nmsub_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: sub.s +// NOMADD4-NONAN: sub.s + +double nmadd_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: add.d +// NOMADD4-NONAN: sub.d + +double nmsub_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: sub.d +// NOMADD4-NONAN: sub.d + diff --git a/test/CodeGenCXX/pr34163.cpp b/test/CodeGenCXX/pr34163.cpp new file mode 100644 index 0000000000000..a200a0f509bce --- /dev/null +++ b/test/CodeGenCXX/pr34163.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple x86_64-linux-gnu -o - -x c++ %s | FileCheck %s + +void f(struct X *) {} + +// CHECK: @_ZTV1X = +struct X { + void a() { delete this; } + virtual ~X() {} + virtual void key_function(); +}; + +// CHECK: define {{.*}} @_ZN1X12key_functionEv( +void X::key_function() {} diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 7c7b2f05f1dc4..545951d5aa119 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -69,6 +69,14 @@ // ARMV7_HARDFLOAT-NOT: "-msoft-float" // ARMV7_HARDFLOAT: "-x" "c" +// RUN: %clang -target arm64-apple-ios10 -### -S %s -arch arm64 2>&1 | \ +// RUN: FileCheck -check-prefix=ARM64-APPLE %s +// ARM64-APPLE: -munwind-table + +// RUN: %clang -target armv7k-apple-watchos4.0 -### -S %s -arch armv7k 2>&1 | \ +// RUN: FileCheck -check-prefix=ARMV7K-APPLE %s +// ARMV7K-APPLE: -munwind-table + // RUN: %clang -target arm-linux -### -S %s -march=armv5e 2>&1 | \ // RUN: FileCheck -check-prefix=ARMV5E %s // ARMV5E: clang diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 12c7ef6eb0b18..3ff49aca6c027 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -26,6 +26,8 @@ // RUN: %clang -target armv7-apple-ios11.1 -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s +// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s // CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \ @@ -45,6 +47,10 @@ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS11 %s // CHECK-VERSION-IOS11: arm64-apple-ios11.1.0 +// RUN: %clang -target armv7-apple-ios9.0 -miphoneos-version-min=11.0 -c -Wno-invalid-ios-deployment-target -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS12 %s +// CHECK-VERSION-IOS12: thumbv7-apple-ios11.0.0 + // RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s // RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \ diff --git a/test/Driver/unknown-std.cpp b/test/Driver/unknown-std.cpp index 195a671edadf1..a7aae51122210 100644 --- a/test/Driver/unknown-std.cpp +++ b/test/Driver/unknown-std.cpp @@ -13,8 +13,8 @@ // CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard // CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard -// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard -// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard +// CHECK-NEXT: note: use 'c++17' for 'ISO C++ 2017 with amendments' standard +// CHECK-NEXT: note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard // CHECK-NEXT: note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard // CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index 0b7fc626ff8a6..92c561a20acc0 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -216,7 +216,7 @@ template<class T> typedef Mystery<T>::type getMysteriousThing() { // \ } template<template<typename> Foo, // expected-error {{template template parameter requires 'class' after the parameter list}} - template<typename> typename Bar, // expected-warning {{template template parameter using 'typename' is a C++1z extension}} + template<typename> typename Bar, // expected-warning {{template template parameter using 'typename' is a C++17 extension}} template<typename> struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}} void func(); diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index 24f38e51d91ed..04821bdb22775 100644 --- a/test/Lexer/cxx-features.cpp +++ b/test/Lexer/cxx-features.cpp @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s -// RUN: %clang_cc1 -fno-rtti -verify %s -DNO_EXCEPTIONS -DNO_RTTI +// RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS // RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify %s // expected-no-diagnostics @@ -22,19 +22,15 @@ // --- C++17 features --- -#if check(variadic_using, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_variadic_using" -#endif - #if check(hex_float, 0, 0, 0, 201603) #error "wrong value for __cpp_hex_float" #endif -#if check(inline_variables, 0, 0, 0, 201606) // FIXME: provisional name +#if check(inline_variables, 0, 0, 0, 201606) #error "wrong value for __cpp_inline_variables" #endif -#if check(aligned_new, 0, 0, 0, 201606) // FIXME: provisional name +#if check(aligned_new, 0, 0, 0, 201606) #error "wrong value for __cpp_aligned_new" #endif @@ -52,7 +48,7 @@ // constexpr checked below -#if check(if_constexpr, 0, 0, 0, 201606) // FIXME: provisional name +#if check(if_constexpr, 0, 0, 0, 201606) #error "wrong value for __cpp_if_constexpr" #endif @@ -60,7 +56,11 @@ // static_assert checked below -#if check(template_auto, 0, 0, 0, 201606) // FIXME: provisional name +#if check(deduction_guides, 0, 0, 0, 201611) +#error "wrong value for __cpp_deduction_guides" +#endif + +#if check(template_auto, 0, 0, 0, 201606) #error "wrong value for __cpp_template_auto" #endif @@ -80,6 +80,10 @@ // inheriting_constructors checked below +#if check(variadic_using, 0, 0, 0, 201611) +#error "wrong value for __cpp_variadic_using" +#endif + #if check(aggregate_bases, 0, 0, 0, 201603) #error "wrong value for __cpp_aggregate_bases" #endif @@ -96,10 +100,6 @@ #error "wrong value for __cpp_template_template_args" #endif -#if check(deduction_guides, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_deduction_guides" -#endif - // --- C++14 features --- #if check(binary_literals, 0, 0, 201304, 201304) @@ -163,6 +163,10 @@ #error "wrong value for __cpp_user_defined_literals" #endif +#if defined(NO_THREADSAFE_STATICS) ? check(threadsafe_static_init, 0, 0, 0, 0) : check(threadsafe_static_init, 200806, 200806, 200806, 200806) +#error "wrong value for __cpp_threadsafe_static_init" +#endif + #if check(lambdas, 0, 200907, 200907, 200907) #error "wrong value for __cpp_lambdas" #endif diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp index 163db72f56f29..3241751a1233a 100644 --- a/test/Lexer/hexfloat.cpp +++ b/test/Lexer/hexfloat.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}} float f = 0x1p+1; @@ -9,10 +9,10 @@ double d = 0x.2p2; float g = 0x1.2p2; double h = 0x1.p2; #if __cplusplus <= 201402L -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} #endif // PR12717: In order to minimally diverge from the C++ standard, we do not lex diff --git a/test/Modules/Inputs/innerstructredef.h b/test/Modules/Inputs/innerstructredef.h new file mode 100644 index 0000000000000..600f44e41cf85 --- /dev/null +++ b/test/Modules/Inputs/innerstructredef.h @@ -0,0 +1,6 @@ +struct Outer { +// This definition is actually hidden since only submodule 'one' is imported. +struct Inner { + int x; +} field; +}; diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 4cb3e8a028045..4788daa431662 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -451,3 +451,12 @@ module DebugNestedB { module objcAtKeywordMissingEnd { header "objcAtKeywordMissingEnd.h" } + +module innerstructredef { + module one { + header "empty.h" + } + module two { + header "innerstructredef.h" + } +} diff --git a/test/Modules/inner-struct-redefines-invisible.m b/test/Modules/inner-struct-redefines-invisible.m new file mode 100644 index 0000000000000..ecf6d808df3d5 --- /dev/null +++ b/test/Modules/inner-struct-redefines-invisible.m @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s +// expected-no-diagnostics + +@import innerstructredef.one; + +struct Outer { +// Should set lexical context when parsing 'Inner' here, otherwise there's a crash: +struct Inner { + int x; +} field; +}; diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index 647762f165cb8..5db06bd3f2a30 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++1z-extensions %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions %s // Need std::initializer_list namespace std { @@ -127,7 +127,7 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} [[]] using ns::i; // expected-error {{an attribute list cannot appear here}} [[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}} [[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}} -namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++1z}} +namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++17}} using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}} using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}} @@ -179,7 +179,7 @@ enum [[]] E2; // expected-error {{forbids forward references}} enum [[]] E1; enum [[]] E3 : int; enum [[]] { - k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++1z}} + k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++17}} }; enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}} enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}} @@ -352,7 +352,7 @@ int fallthru(int n) { switch (n) { case 0: n += 5; - [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++1z extension}} + [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++17 extension}} case 1: n *= 2; break; diff --git a/test/Parser/cxx1z-constexpr-lambdas.cpp b/test/Parser/cxx1z-constexpr-lambdas.cpp index ea000e361ccb6..4cf3d12211676 100644 --- a/test/Parser/cxx1z-constexpr-lambdas.cpp +++ b/test/Parser/cxx1z-constexpr-lambdas.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++1z %s -verify +// RUN: %clang_cc1 -std=c++17 %s -verify // RUN: %clang_cc1 -std=c++14 %s -verify // RUN: %clang_cc1 -std=c++11 %s -verify @@ -23,9 +23,9 @@ auto XL16 = [] () constexpr { }; #else -auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++1z extension}} -auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++1z extension}} -auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++1z extension}} +auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}} +auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}} +auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}} #endif diff --git a/test/Parser/cxx1z-nested-namespace-definition.cpp b/test/Parser/cxx1z-nested-namespace-definition.cpp index 96f34c540acc2..e5e809aa03665 100644 --- a/test/Parser/cxx1z-nested-namespace-definition.cpp +++ b/test/Parser/cxx1z-nested-namespace-definition.cpp @@ -2,13 +2,13 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT // RUN: %clang_cc1 -x c++ %t -DFIXIT -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z -Wc++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat namespace foo1::foo2::foo3 { #if __cplusplus <= 201400L -// expected-warning@-2 {{nested namespace definition is a C++1z extension; define each namespace separately}} +// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}} #else -// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++1z}} +// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}} #endif int foo(int x) { return x; } } diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 3a8e5dbd3fd89..5a77d06d24035 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -4686,6 +4686,16 @@ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-MSA %s // MIPS-MSA:#define __mips_msa 1 // +// RUN: %clang_cc1 -target-feature +nomadd4 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-NOMADD4 %s +// MIPS-NOMADD4:#define __mips_no_madd4 1 +// +// RUN: %clang_cc1 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-MADD4 %s +// MIPS-MADD4-NOT:#define __mips_no_madd4 1 +// // RUN: %clang_cc1 -target-cpu mips32r3 -target-feature +nan2008 \ // RUN: -E -dM -triple=mips-none-none < /dev/null \ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-NAN2008 %s diff --git a/test/SemaCUDA/function-overload.cu b/test/SemaCUDA/function-overload.cu index 3d4c29c42cee1..adf488b5eea37 100644 --- a/test/SemaCUDA/function-overload.cu +++ b/test/SemaCUDA/function-overload.cu @@ -222,7 +222,7 @@ GlobalFnPtr fp_g = g; // Test overloading of destructors // Can't mix H and unattributed destructors struct d_h { - ~d_h() {} // expected-note {{previous declaration is here}} + ~d_h() {} // expected-note {{previous definition is here}} __host__ ~d_h() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCUDA/no-destructor-overload.cu b/test/SemaCUDA/no-destructor-overload.cu index aa6971ee8ca82..32dbb8db76ecb 100644 --- a/test/SemaCUDA/no-destructor-overload.cu +++ b/test/SemaCUDA/no-destructor-overload.cu @@ -7,27 +7,27 @@ // giant change to clang, and the use cases seem quite limited. struct A { - ~A() {} // expected-note {{previous declaration is here}} + ~A() {} // expected-note {{previous definition is here}} __device__ ~A() {} // expected-error {{destructor cannot be redeclared}} }; struct B { - __host__ ~B() {} // expected-note {{previous declaration is here}} + __host__ ~B() {} // expected-note {{previous definition is here}} __host__ __device__ ~B() {} // expected-error {{destructor cannot be redeclared}} }; struct C { - __host__ __device__ ~C() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~C() {} // expected-note {{previous definition is here}} __host__ ~C() {} // expected-error {{destructor cannot be redeclared}} }; struct D { - __device__ ~D() {} // expected-note {{previous declaration is here}} + __device__ ~D() {} // expected-note {{previous definition is here}} __host__ __device__ ~D() {} // expected-error {{destructor cannot be redeclared}} }; struct E { - __host__ __device__ ~E() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~E() {} // expected-note {{previous definition is here}} __device__ ~E() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCXX/constant-expression-cxx1y.cpp b/test/SemaCXX/constant-expression-cxx1y.cpp index ac4e0fd471aed..0c0cb0ec58a1a 100644 --- a/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/test/SemaCXX/constant-expression-cxx1y.cpp @@ -982,3 +982,9 @@ constexpr void PR28739(int n) { // expected-error {{never produces a constant}} int *p = &n; p += (__int128)(unsigned long)-1; // expected-note {{cannot refer to element 18446744073709551615 of non-array object in a constant expression}} } + +constexpr void Void(int n) { + void(n + 1); + void(); +} +constexpr int void_test = (Void(0), 1); diff --git a/test/SemaCXX/cxx0x-compat.cpp b/test/SemaCXX/cxx0x-compat.cpp index bcf0cf11dc183..8f7aaab6a4386 100644 --- a/test/SemaCXX/cxx0x-compat.cpp +++ b/test/SemaCXX/cxx0x-compat.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++11-compat -verify %s -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++11-compat -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++11-compat -verify %s #if __cplusplus < 201103L @@ -42,14 +42,14 @@ void h(size_t foo, size_t bar) { char c = 'x'_x; // expected-warning {{will be treated as a user-defined literal suffix}} template<int ...N> int f() { // expected-warning {{C++11 extension}} - return (N + ...); // expected-warning {{C++1z extension}} + return (N + ...); // expected-warning {{C++17 extension}} } #else auto init_capture = [a(0)] {}; // expected-warning {{initialized lambda captures are incompatible with C++ standards before C++14}} -static_assert(true); // expected-warning {{incompatible with C++ standards before C++1z}} +static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}} -template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++1z}} +template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp index 668c242802580..9232a8b6eba04 100644 --- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -286,6 +286,29 @@ namespace tuple_tests { } } +namespace dependent { + template<typename T> struct X { + X(T); + }; + template<typename T> int Var(T t) { + X x(t); + return X(x) + 1; // expected-error {{invalid operands}} + } + template<typename T> int Cast(T t) { + return X(X(t)) + 1; // expected-error {{invalid operands}} + } + template<typename T> int New(T t) { + return X(new X(t)) + 1; // expected-error {{invalid operands}} + }; + template int Var(float); // expected-note {{instantiation of}} + template int Cast(float); // expected-note {{instantiation of}} + template int New(float); // expected-note {{instantiation of}} + template<typename T> int operator+(X<T>, int); + template int Var(int); + template int Cast(int); + template int New(int); +} + #else // expected-no-diagnostics diff --git a/test/SemaCXX/cxx1z-init-statement.cpp b/test/SemaCXX/cxx1z-init-statement.cpp index 4afe0402d13f2..d37acd08ce77d 100644 --- a/test/SemaCXX/cxx1z-init-statement.cpp +++ b/test/SemaCXX/cxx1z-init-statement.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++1z -verify %s +// RUN: %clang_cc1 -std=c++17 -verify %s void testIf() { int x = 0; diff --git a/test/SemaCXX/deprecated.cpp b/test/SemaCXX/deprecated.cpp index ac477d4b66bc6..26f30c91b0980 100644 --- a/test/SemaCXX/deprecated.cpp +++ b/test/SemaCXX/deprecated.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++17 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS #include "Inputs/register.h" @@ -12,8 +12,8 @@ void h() throw(int); void i() throw(...); #if __cplusplus > 201402L // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} #elif __cplusplus >= 201103L // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept' instead}} // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept(false)' instead}} @@ -23,7 +23,7 @@ void i() throw(...); void stuff() { register int n; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow 'register' storage class specifier}} + // expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}} #elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS) // expected-warning@-4 {{'register' storage class specifier is deprecated}} #endif @@ -34,14 +34,14 @@ void stuff() { bool b; ++b; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif b++; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif diff --git a/test/SemaCXX/inline.cpp b/test/SemaCXX/inline.cpp index b20bc18d0a3fe..ba29521ce504a 100644 --- a/test/SemaCXX/inline.cpp +++ b/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++1z %s -Wc++98-c++11-c++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wc++98-c++11-c++14-compat // Check that we don't allow illegal uses of inline // (checking C++-only constructs here) @@ -12,7 +12,7 @@ void localVar() { // Check that we warn appropriately. #if __cplusplus <= 201402L -inline int a; // expected-warning{{inline variables are a C++1z extension}} +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++1z}} +inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp index 7de4d07b50b8e..196375c3d6870 100644 --- a/test/SemaCXX/static-assert.cpp +++ b/test/SemaCXX/static-assert.cpp @@ -49,5 +49,5 @@ struct X { ~X(); }; StaticAssertProtected<int> sap1; StaticAssertProtected<X> sap2; // expected-note {{instantiation}} -static_assert(true); // expected-warning {{C++1z extension}} +static_assert(true); // expected-warning {{C++17 extension}} static_assert(false); // expected-error-re {{failed{{$}}}} expected-warning {{extension}} diff --git a/test/SemaCXX/warn-c++1z-extensions.cpp b/test/SemaCXX/warn-c++1z-extensions.cpp index 9b5e1c205cf32..a0d44a34ffed1 100644 --- a/test/SemaCXX/warn-c++1z-extensions.cpp +++ b/test/SemaCXX/warn-c++1z-extensions.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s void f() { - if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++1z extension}} - switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++1z extension}} + if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++17 extension}} + switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++17 extension}} case 5: break; } } diff --git a/test/SemaCXX/warn-shadow.cpp b/test/SemaCXX/warn-shadow.cpp index d5f0623eb3203..3d09c786285ad 100644 --- a/test/SemaCXX/warn-shadow.cpp +++ b/test/SemaCXX/warn-shadow.cpp @@ -213,3 +213,12 @@ typedef int externC; // expected-note {{previous declaration is here}} void handleLinkageSpec() { typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}} } + +namespace PR33947 { +void f(int a) { + struct A { + void g(int a) {} + A() { int a; } + }; +} +} diff --git a/test/SemaObjC/illegal-nonarc-bridged-cast.m b/test/SemaObjC/illegal-nonarc-bridged-cast.m index f3406ef983cc5..23c7b96e3709e 100644 --- a/test/SemaObjC/illegal-nonarc-bridged-cast.m +++ b/test/SemaObjC/illegal-nonarc-bridged-cast.m @@ -1,8 +1,9 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -Wcast-qual -verify %s // rdar://10597832 typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; +@class NSString; @interface NSString @end @@ -18,7 +19,7 @@ NSString *CreateNSString(); void from_cf() { id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} id obj2 = (__bridge_transfer NSString*)CFCreateString(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} - (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} + (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} expected-warning {{cast from 'const void *' to 'int *' drops const qualifier}} id obj3 = (__bridge id)CFGetSomething(); id obj4 = (__bridge NSString*)CFGetString(); } @@ -41,3 +42,15 @@ void to_cf_ignored(id obj) { CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // no-warning CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // no-warning } + +// Check that clang doesn't warn about dropping const from Objective-C object +// types. +void test_wcast_qual() { + CFStringRef c; + NSString *n0 = (NSString *)c; + NSString **n1 = (NSString **)&c; + const NSString *n2; + const NSString **n3; + void *p0 = (void *)n2; + void **p1 = (void **)n3; +} diff --git a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp index cfaad0cd0c96f..0b8f0eed16019 100644 --- a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp +++ b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp @@ -25,7 +25,7 @@ namespace CanonicalNullptr { } namespace Auto { - template<auto> struct A { }; // expected-error {{until C++1z}} + template<auto> struct A { }; // expected-error {{until C++17}} } namespace check_conversion_early { |