mirror of
https://github.com/github/codeql.git
synced 2025-12-23 04:06:37 +01:00
C++: add a test for self-valued iterators
This commit is contained in:
committed by
Mathias Vorreiter Pedersen
parent
2187e56376
commit
971456c725
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user