summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-03-04 21:27:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-03-04 21:27:21 +0000
commit8ee39e31bb40aea70afb40611b0cc39d23175552 (patch)
treee59d491330f40de517db504e6878e9752070e9c6 /clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
parentb89f0fa2a2853e14a989d30bb8789b5815462d1a (diff)
downloadbcm5719-llvm-8ee39e31bb40aea70afb40611b0cc39d23175552.tar.gz
bcm5719-llvm-8ee39e31bb40aea70afb40611b0cc39d23175552.zip
Implement P0036R0: remove support for empty unary folds of +, *, |, &.
llvm-svn: 262747
Diffstat (limited to 'clang/test/SemaTemplate/cxx1z-fold-expressions.cpp')
-rw-r--r--clang/test/SemaTemplate/cxx1z-fold-expressions.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
index 8bb79113fa9..aefee92f648 100644
--- a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
+++ b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
@@ -25,10 +25,6 @@ constexpr bool check() {
static_assert(check());
template<int ...N> void empty() {
- static_assert((N + ...) == 0);
- static_assert((N * ...) == 1);
- static_assert((N | ...) == 0);
- static_assert((N & ...) == -1);
static_assert((N || ...) == false);
static_assert((N && ...) == true);
(N, ...);
@@ -36,14 +32,19 @@ template<int ...N> void empty() {
template void empty<>();
// An empty fold-expression isn't a null pointer just because it's an integer
-// with value 0.
+// with value 0. (This is no longer an issue since empty pack expansions don't
+// produce integers any more.)
template<int ...N> void null_ptr() {
- void *p = (N + ...); // expected-error {{rvalue of type 'int'}}
- void *q = (N | ...); // expected-error {{rvalue of type 'int'}}
+ void *p = (N || ...); // expected-error {{rvalue of type 'bool'}}
+ void *q = (N , ...); // expected-error {{rvalue of type 'void'}}
}
template void null_ptr<>(); // expected-note {{in instantiation of}}
template<int ...N> void bad_empty() {
+ (N + ...); // expected-error {{empty expansion for operator '+' with no fallback}}
+ (N * ...); // expected-error {{empty expansion for operator '*' with no fallback}}
+ (N | ...); // expected-error {{empty expansion for operator '|' with no fallback}}
+ (N & ...); // expected-error {{empty expansion for operator '&' with no fallback}}
(N - ...); // expected-error {{empty expansion for operator '-' with no fallback}}
(N / ...); // expected-error {{empty expansion for operator '/' with no fallback}}
(N % ...); // expected-error {{empty expansion for operator '%' with no fallback}}
OpenPOWER on IntegriCloud