From 5df539a1004bc4db5c38b33ba3e219595a10ae3c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:41 +0000 Subject: Vendor import of clang release_40 branch r292732: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292732 --- test/SemaTemplate/class-template-spec.cpp | 12 ++++++------ test/SemaTemplate/cxx1z-using-declaration.cpp | 6 +++--- test/SemaTemplate/partial-order.cpp | 14 ++++++++++++++ test/SemaTemplate/temp_arg_nontype.cpp | 16 ++++++++-------- test/SemaTemplate/temp_arg_template_cxx1z.cpp | 8 ++++---- 5 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 test/SemaTemplate/partial-order.cpp (limited to 'test/SemaTemplate') diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index 518ec78e6f7d0..00e03ef61eb07 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -207,19 +207,19 @@ namespace NTTPTypeVsPartialOrder { struct X { typedef int value_type; }; template struct Y { typedef T value_type; }; - template struct A; // expected-note {{template}} + template struct A; template struct A {}; - template struct A, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} + template struct A, N> {}; A ax; A, 0> ay; - template struct B; // expected-note {{template}} - template struct B<0, T, N>; // expected-note {{matches}} + template struct B; + template struct B<0, T, N>; template struct B<0, X, N> {}; - template struct B<0, Y, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} expected-note {{matches}} + template struct B<0, Y, N> {}; B<0, X, 0> bx; - B<0, Y, 0> by; // expected-error {{ambiguous}} + B<0, Y, 0> by; } namespace DefaultArgVsPartialSpec { diff --git a/test/SemaTemplate/cxx1z-using-declaration.cpp b/test/SemaTemplate/cxx1z-using-declaration.cpp index 7bef36db1f47a..87ca748f8fd58 100644 --- a/test/SemaTemplate/cxx1z-using-declaration.cpp +++ b/test/SemaTemplate/cxx1z-using-declaration.cpp @@ -17,7 +17,7 @@ void test_Unexpanded() { // Test using non-type members from pack of base classes. template struct A : T... { // expected-note 2{{candidate}} - using T::T ...; // expected-note 6{{inherited here}} + using T::T ...; // expected-note 2{{inherited here}} using T::operator() ...; using T::operator T* ...; using T::h ...; @@ -29,7 +29,7 @@ template struct A : T... { // expected-note 2{{candidate}} }; namespace test_A { - struct X { // expected-note 2{{candidate}} + struct X { X(); X(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} @@ -43,7 +43,7 @@ namespace test_A { operator Y *(); void h(int, int); // expected-note {{not viable}} }; - struct Z { // expected-note 2{{candidate}} + struct Z { Z(); Z(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} diff --git a/test/SemaTemplate/partial-order.cpp b/test/SemaTemplate/partial-order.cpp new file mode 100644 index 0000000000000..0a151de390236 --- /dev/null +++ b/test/SemaTemplate/partial-order.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify + +// expected-no-diagnostics + +namespace hana_enable_if_idiom { + template struct A {}; + template> struct B; + template struct B> {}; + template struct B> {}; + struct C { + static const bool value = true; + }; + B b; +} diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 27a0a03f84f46..5b72b8c6549a4 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -370,13 +370,13 @@ namespace PR17696 { } namespace partial_order_different_types { - // These are unordered because the type of the final argument doesn't match. - template struct A; // expected-note {{here}} - template struct A<0, N, T, U, V> {}; // expected-note {{matches}} - template struct A<0, 0, T, U, V> {}; // expected-note {{matches}} - // expected-error@-1 {{not more specialized than the primary}} - // expected-note@-2 {{deduced non-type template argument does not have the same type as the corresponding template parameter ('U' vs 'type-parameter-0-0')}} - A<0, 0, int, int, 0> a; // expected-error {{ambiguous partial specializations}} + template struct A; + template struct A<0, N, T, U, V>; // expected-note {{matches}} + // FIXME: It appears that this partial specialization should be ill-formed as + // it is not more specialized than the primary template. V is not deducible + // because it does not have the same type as the corresponding parameter. + template struct A<0, N, T, U, V> {}; // expected-note {{matches}} + A<0, 0, int, int, 0> a; // expected-error {{ambiguous}} } namespace partial_order_references { @@ -434,7 +434,7 @@ namespace dependent_nested_partial_specialization { template struct E { template struct F; // expected-note {{template}} - template struct F {}; // expected-error {{not more specialized than the primary}} expected-note {{does not have the same type}} + template struct F {}; // expected-error {{not more specialized than the primary}} }; E::F e1; // expected-note {{instantiation of}} } diff --git a/test/SemaTemplate/temp_arg_template_cxx1z.cpp b/test/SemaTemplate/temp_arg_template_cxx1z.cpp index aa517c3285993..703935dcd5c19 100644 --- a/test/SemaTemplate/temp_arg_template_cxx1z.cpp +++ b/test/SemaTemplate/temp_arg_template_cxx1z.cpp @@ -79,13 +79,13 @@ namespace Auto { TInt ia; TInt iap; // expected-error {{different template parameters}} - TInt ida; // FIXME expected-error {{different template parameters}} + TInt ida; TInt ii; TInt iip; // expected-error {{different template parameters}} TIntPtr ipa; TIntPtr ipap; - TIntPtr ipda; // FIXME expected-error {{different template parameters}} + TIntPtr ipda; TIntPtr ipi; // expected-error {{different template parameters}} TIntPtr ipip; @@ -114,6 +114,6 @@ namespace Auto { int n; template struct SubstFailure; - TInt isf; // expected-error {{different template parameters}} - TIntPtr ipsf; // expected-error {{different template parameters}} + TInt isf; // FIXME: this should be ill-formed + TIntPtr ipsf; } -- cgit v1.2.3