File tree 2 files changed +29
-1
lines changed 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
+ TEST (CheckProperlyDealsWithOperatorBoolOverrides)
319
+ {
320
+ class TruthyUnlessCopied
321
+ {
322
+ public:
323
+ TruthyUnlessCopied ()
324
+ : truthy_(true )
325
+ {
326
+ }
327
+
328
+ TruthyUnlessCopied (const TruthyUnlessCopied& orig)
329
+ : truthy_(false )
330
+ {
331
+ }
332
+
333
+ operator bool () const
334
+ {
335
+ return truthy_;
336
+ }
337
+
338
+ private:
339
+ bool truthy_;
340
+ };
341
+
342
+ TruthyUnlessCopied objectThatShouldBeTruthy;
343
+ CHECK (objectThatShouldBeTruthy);
344
+ }
345
+
318
346
}
You can’t perform that action at this time.
0 commit comments