C++: add a test for self-valued iterators

This commit is contained in:
Robert Marsh
2023-06-14 13:18:29 -04:00
committed by Mathias Vorreiter Pedersen
parent 2187e56376
commit 971456c725

View File

@@ -0,0 +1,21 @@
#include "../../../include/iterator.h"
int source();
template<typename T>
void sink(T);
template<> struct std::iterator_traits<unsigned long>
{ // get traits from integer type
typedef std::input_iterator_tag iterator_category;
typedef unsigned long value_type;
typedef unsigned long difference_type;
typedef unsigned long distance_type;
typedef unsigned long * pointer;
typedef unsigned long& reference;
};
int test() {
unsigned long x = source();
sink(x); // $ ast MISSING: ir
}