[Bug c++/89836] New: converted constant expression of type bool and explicit conversion functions

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 26 19:56:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89836

            Bug ID: 89836
           Summary: converted constant expression of type bool and
                    explicit conversion functions
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

struct W { 
  constexpr explicit operator bool() { return true; };
};

struct U {
  explicit(W()) U(int);
};

doesn't compile because of the "explicit" specifier.  But it should,
<http://eel.is/c++draft/expr.const#def:contextually_converted_constant_expression_of_type_bool>
doesn't require converting conversions only.


More information about the Gcc-bugs mailing list