summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2017-07-05 20:20:15 +0000
committerDouglas Gregor <dgregor@apple.com>2017-07-05 20:20:15 +0000
commit6907b9898ead736540d31fe32057102bb4106390 (patch)
tree2829040f0a7832413f51d8292be8c59a89d2b246 /test/SemaTemplate
parentd93c41c8dca79a6d02dffdaac23003e7d50cd00a (diff)
Cope with Range-v3's CONCEPT_REQUIRES idiom
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307197 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/overload-candidates.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaTemplate/overload-candidates.cpp b/test/SemaTemplate/overload-candidates.cpp
index edbbb84eca..8e0ddb0a5e 100644
--- a/test/SemaTemplate/overload-candidates.cpp
+++ b/test/SemaTemplate/overload-candidates.cpp
@@ -137,4 +137,30 @@ namespace PR15673 {
#endif
void wibble() {}
void wobble() { wibble<int>(); } // expected-error {{no matching function for call to 'wibble'}}
+
+ template<typename T>
+ struct some_passing_trait : std::true_type {};
+
+#if __cplusplus <= 199711L
+ // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}}
+ // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}}
+#endif
+ template<typename T,
+ int n = 42,
+ typename std::enable_if<n == 43 || (some_passing_trait<T>::value && some_trait<T>::value), int>::type = 0>
+ void almost_rangesv3(); // expected-note{{candidate template ignored: requirement '42 == 43 || (some_passing_trait<int>::value && some_trait<int>::value)' was not satisfied}}
+ void test_almost_rangesv3() { almost_rangesv3<int>(); } // expected-error{{no matching function for call to 'almost_rangesv3'}}
+
+ #define CONCEPT_REQUIRES_(...) \
+ int x = 42, \
+ typename std::enable_if<(x == 43) || (__VA_ARGS__)>::type = 0
+
+#if __cplusplus <= 199711L
+ // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}}
+ // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}}
+#endif
+ template<typename T,
+ CONCEPT_REQUIRES_(some_passing_trait<T>::value && some_trait<T>::value)>
+ void rangesv3(); // expected-note{{candidate template ignored: requirement 'some_trait<int>::value' was not satisfied [with T = int, x = 42]}}
+ void test_rangesv3() { rangesv3<int>(); } // expected-error{{no matching function for call to 'rangesv3'}}
}