File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace UnitTest {
9
9
10
10
11
11
template < typename Value >
12
- bool Check (Value const value)
12
+ bool Check (Value const & value)
13
13
{
14
14
return !!value; // doing double negative to avoid silly VS warnings
15
15
}
Original file line number Diff line number Diff line change @@ -315,4 +315,32 @@ namespace {
315
315
CHECK_EQUAL (1234 , reporter.lastFailedLine );
316
316
}
317
317
318
+ class TruthyUnlessCopied
319
+ {
320
+ public:
321
+ TruthyUnlessCopied ()
322
+ : truthy_(true )
323
+ {
324
+ }
325
+
326
+ TruthyUnlessCopied (const TruthyUnlessCopied&)
327
+ : truthy_(false )
328
+ {
329
+ }
330
+
331
+ operator bool () const
332
+ {
333
+ return truthy_;
334
+ }
335
+
336
+ private:
337
+ bool truthy_;
338
+ };
339
+
340
+ TEST (CheckProperlyDealsWithOperatorBoolOverrides)
341
+ {
342
+ TruthyUnlessCopied objectThatShouldBeTruthy;
343
+ CHECK (objectThatShouldBeTruthy);
344
+ }
345
+
318
346
}
You can’t perform that action at this time.
0 commit comments