summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/instantiate-field.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/instantiate-field.cpp')
-rw-r--r--test/SemaTemplate/instantiate-field.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp
index 60d4b21..a260635 100644
--- a/test/SemaTemplate/instantiate-field.cpp
+++ b/test/SemaTemplate/instantiate-field.cpp
@@ -26,3 +26,58 @@ void test2(const X<float> *xf) {
void test3(const X<int(int)> *xf) {
(void)xf->x; // expected-note{{in instantiation of template class 'X<int (int)>' requested here}}
}
+
+namespace PR7123 {
+ template <class > struct requirement_;
+
+ template <void(*)()> struct instantiate
+ { };
+
+ template <class > struct requirement ;
+ struct failed ;
+
+ template <class Model> struct requirement<failed *Model::*>
+ {
+ static void failed()
+ {
+ ((Model*)0)->~Model(); // expected-note{{in instantiation of}}
+ }
+ };
+
+ template <class Model> struct requirement_<void(*)(Model)> : requirement<failed *Model::*>
+ { };
+
+ template <int> struct Requires_
+ { typedef void type; };
+
+ template <class Model> struct usage_requirements
+ {
+ ~usage_requirements()
+ {((Model*)0)->~Model(); } // expected-note{{in instantiation of}}
+ };
+
+ template < typename TT > struct BidirectionalIterator
+ {
+ enum
+ { value = 0 };
+
+ instantiate< requirement_<void(*)(usage_requirements<BidirectionalIterator>)>::failed> int534; // expected-note{{in instantiation of}}
+
+ ~BidirectionalIterator()
+ { i--; } // expected-error{{cannot decrement value of type 'PR7123::X'}}
+
+ TT i;
+ };
+
+ struct X
+ { };
+
+ template<typename RanIter>
+ typename Requires_< BidirectionalIterator<RanIter>::value >::type sort(RanIter,RanIter){}
+
+ void f()
+ {
+ X x;
+ sort(x,x);
+ }
+}
OpenPOWER on IntegriCloud