C++ `explicit` not explicit enough for CanType?

I just discovered a mistake where the constructor for ForeignErrorConvention takes Type parameters when they should be CanType parameters. This "works" because field initialization apparently counts as an explicit call to the CanType(Type) constructor which is marked explicit. This is surely not what the author of ForeignErrorConvention wanted.

This seems both unfortunate and subtle. I took a stab at removing the problematic CanType constructor and the fallout wasn't insurmountable.

What do people want to do? Live with this C++ subtlety? Remove the "explicit-is-not-enough" CanType constructor? Or make it a factory method?

Terms of Service

Privacy Policy

Cookie Policy