Skip to content

Commit bf79226

Browse files
authored
Multithreading tests: Add dummy definition to keep compiler happy (#737)
* Multithreading tests: Add dummy definition to keep compiler happy This type is instantiated by the deleted constructor whose original purpose is to allow an implicit conversion from non-const iterator to const iterator. When applied to the const iterator itself, it enables an implicit conversion from garbage to const iterator. The conversion is deleted, but the compiler still instantiates it, so we define the type to keep everybody happy. * Clarify the purpose of the specialization
1 parent 84d2814 commit bf79226

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/test/multi_threaded_common.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,17 @@ namespace concurrent_collections
237237
{
238238
return it += offset;
239239
}
240+
241+
// We have a constructor whose purpose is to offer an implicit conversion from
242+
// non-const iterator to const iterator. When applied to a const
243+
// iterator, it offers implicit construction from this garbage type
244+
// to const iterator (triggering its instantiation), but then the constructor
245+
// is deleted by SFINAE, so the type is never actually created at runtime.
246+
// This specialization is necessary so that the garbage instantiation succeeds.
247+
template<typename Container>
248+
struct concurrency_checked_random_access_iterator<Container, void, void>
249+
{
250+
};
240251
#pragma endregion
241252

242253
struct concurrency_guard

0 commit comments

Comments
 (0)