diff --git a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h index e00db146da..6eab90029f 100644 --- a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h +++ b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h @@ -76,6 +76,11 @@ class ConfigureQueueStatus { BSLMF_NESTED_TRAIT_DECLARATION(ConfigureQueueStatus, bslma::UsesBslmaAllocator) + // Use of an `UnspecifiedBool` to prevent implicit conversions to + // integral values, and comparisons between different classes which + // have boolean operators. + typedef bsls::UnspecifiedBool::BoolType BoolType; + // CREATORS /// Default constructor, use the optionally specified `allocator`. @@ -103,7 +108,7 @@ class ConfigureQueueStatus { // ACCESSORS /// Return true if this result indicates success, and false otherwise. - operator bool() const; + operator BoolType() const; /// Return the queueId associated to this operation result, if any. const QueueId& queueId() const; @@ -198,9 +203,10 @@ ConfigureQueueStatus::operator=(const ConfigureQueueStatus& other) } // ACCESSORS -inline ConfigureQueueStatus::operator bool() const +inline ConfigureQueueStatus::operator BoolType() const { - return result() == bmqt::ConfigureQueueResult::e_SUCCESS; + return bsls::UnspecifiedBool::makeValue( + result() == bmqt::ConfigureQueueResult::e_SUCCESS); } inline const QueueId& ConfigureQueueStatus::queueId() const