aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp')
-rw-r--r--test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp61
1 files changed, 58 insertions, 3 deletions
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 34202494c0d8..f42fc9b6e5aa 100644
--- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -108,7 +108,7 @@ void g() {
extern int incomplete[];
for (auto a : incomplete) // expected-error {{cannot use incomplete type 'int []' as a range}}
;
- extern struct Incomplete also_incomplete[2]; // expected-note {{forward declaration}}
+ extern struct Incomplete also_incomplete[2]; // expected-note 2{{forward declaration}}
for (auto &a : also_incomplete) // expected-error {{cannot use incomplete type 'struct Incomplete [2]' as a range}}
;
@@ -150,9 +150,9 @@ void g() {
struct NoEnd {
null_t begin();
};
- for (auto u : NoBegin()) { // expected-error {{range type 'NoBegin' has 'end' member but no 'begin' member}}
+ for (auto u : NoBegin()) { // expected-error {{no viable 'begin' function available}}
}
- for (auto u : NoEnd()) { // expected-error {{range type 'NoEnd' has 'begin' member but no 'end' member}}
+ for (auto u : NoEnd()) { // expected-error {{no viable 'end' function available}}
}
struct NoIncr {
@@ -271,3 +271,58 @@ namespace rdar13712739 {
template void foo(const int&); // expected-note{{in instantiation of function template specialization}}
}
+
+namespace p0962r1 {
+ namespace NA {
+ struct A {
+ void begin();
+ };
+ int *begin(A);
+ int *end(A);
+ }
+
+ namespace NB {
+ struct B {
+ void end();
+ };
+ int *begin(B);
+ int *end(B);
+ }
+
+ namespace NC {
+ struct C {
+ void begin();
+ };
+ int *begin(C);
+ }
+
+ namespace ND {
+ struct D {
+ void end();
+ };
+ int *end(D);
+ }
+
+ namespace NE {
+ struct E {
+ void begin(); // expected-note {{member is not a candidate because range type 'p0962r1::NE::E' has no 'end' member}}
+ };
+ int *end(E);
+ }
+
+ namespace NF {
+ struct F {
+ void end(); // expected-note {{member is not a candidate because range type 'p0962r1::NF::F' has no 'begin' member}}
+ };
+ int *begin(F);
+ }
+
+ void use(NA::A a, NB::B b, NC::C c, ND::D d, NE::E e, NF::F f) {
+ for (auto x : a) {}
+ for (auto x : b) {}
+ for (auto x : c) {} // expected-error {{no viable 'end' function}}
+ for (auto x : d) {} // expected-error {{no viable 'begin' function}}
+ for (auto x : e) {} // expected-error {{no viable 'begin' function}}
+ for (auto x : f) {} // expected-error {{no viable 'end' function}}
+ }
+}