How to prevent compilation if error status is ignored?

During a talk at cppcon, Titus Winters announces (at 42:00) that they have Status . What the magic is about this class is that the C ++ assembly should fail if the object is Status

returned and nothing is done with it (note that can be called explicitly IgnoreError()

if that's the right thing to do).

How is this possible?

As far as I can tell, the class Status

has nothing special. I suppose they should crack this rule in their build process, but how can this be done?

+3


source to share


1 answer


The [[nodiscard]] attribute is now used for this .

Additional Information:



0


source







All Articles