http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47080
Summary: explicit conversion function return conversions not
restricted to qualifications
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
n3225 only allows a qualification conversion for the return of an explicit
conversion function when converting to a non-class type:
struct A {
explicit operator int();
};
int main() {
bool b((A())); // should not work
!A(); // should not work!
}
Both are not valid according to 13.3.1.5/1 (second case uses candidate function
provided by 13.6/23, for which the bool parameter uses contextual conversion).
GCC accepts both.