summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-07-12 18:49:13 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-07-12 18:49:13 +0000
commit746e35e8a13b35197f9ede1cf5b4e7629c18ff75 (patch)
tree008a0376d37a248bcacb7149110de8316d72172c /clang/test
parentb6d5c5871857f101cd88e99d115b310abf565bba (diff)
downloadbcm5719-llvm-746e35e8a13b35197f9ede1cf5b4e7629c18ff75.tar.gz
bcm5719-llvm-746e35e8a13b35197f9ede1cf5b4e7629c18ff75.zip
Add tests for function conversions in conversion function template
deduction. llvm-svn: 336931
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
index 89478ed39f6..085976b0813 100644
--- a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
+++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
@@ -129,4 +129,21 @@ namespace non_ptr_ref_cv_qual {
};
int (&test_conv_to_arr_1)[3] = ConvToArr(); // ok
const int (&test_conv_to_arr_2)[3] = ConvToArr(); // ok, with qualification conversion
+
+#if __cplusplus >= 201702L
+ template<bool Noexcept, typename T, typename ...U> using Function = T(U...) noexcept(Noexcept);
+ template<bool Noexcept> struct ConvToFunction {
+ template <typename T, typename ...U> operator Function<Noexcept, T, U...>&(); // expected-note {{candidate}}
+ };
+ void (&fn1)(int) noexcept(false) = ConvToFunction<false>();
+ void (&fn2)(int) noexcept(true) = ConvToFunction<false>(); // expected-error {{no viable}}
+ void (&fn3)(int) noexcept(false) = ConvToFunction<true>();
+ void (&fn4)(int) noexcept(true) = ConvToFunction<true>();
+
+ struct ConvToFunctionDeducingNoexcept {
+ template <bool Noexcept, typename T, typename ...U> operator Function<Noexcept, T, U...>&();
+ };
+ void (&fn5)(int) noexcept(false) = ConvToFunctionDeducingNoexcept();
+ void (&fn6)(int) noexcept(true) = ConvToFunctionDeducingNoexcept();
+#endif
}
OpenPOWER on IntegriCloud