cpp: do not mark boolean(isl_bool) constructor as explicit
commit29aee98ce31405f9ae23121214973fe451cbb50f
authorTobias Grosser <tobias@grosser.es>
Sat, 13 May 2017 09:02:45 +0000 (13 11:02 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Wed, 17 May 2017 08:11:50 +0000 (17 10:11 +0200)
treedf282f568efd65111c4f3f7c1b8f1d85158d1063
parentd96d7ae28faf51ba63a6f95c549761c9fb4bd2ec
cpp: do not mark boolean(isl_bool) constructor as explicit

The isl::boolean class was created with the goal of disallowing
construction from isl_bool and always requiring the user to convert an
isl_bool to isl:boolean using isl::manage(isl_bool). To achieve this the
boolean(isl_bool) constructor was marked private with the goal of
triggering compiler errors whenever an isl boolean object is constructed
from an isl_bool value. However, as the boolean(isl_bool) constructor
was accidentally marked as 'explicit', it did not take part in the
normal overload resolution. As a result, users did not receive an error
that a private constructor is accessed, but instead the isl_bool value
was implicitly converted to bool and the public boolean(bool)
constructor was called. This was incorrect, as the conversion from
isl_bool to bool turned isl_bool_error values silently into true. By
dropping the 'explicit' marker the boolean(isl_bool) constructor takes
again part in overload resolution and instead of silent corruptions, the
user receives the expected compiler error.

Suggested-by: Michael Kruse <isl@meinersbur.de>
Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
interface/isl.h.top