This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to implement explicit conversion operators


I thought this was going to be simpler than it turned out to be. Allowing explicit on conversion ops and then checking the flag on them wasn't enough, because we were only handling LOOKUP_ONLYCONVERTING properly in cases where we are calling a constructor directly. Extending this to support direct-initialization using explicit conversion ops required me to add a flags parm to a bunch more functions, and choose whether or not to set LOOKUP_ONLYCONVERTING at the point where we ask for the conversion rather than lower down.

After I got this working, I noticed that explicit conversion ops to class type were still broken; this turns out to be a bug in the specification which will need to be fixed before C++0x is ready. For the moment I've worked around this by treating all conversions for the first parameter of a copy constructor as direct-initialization; look for the word "hack" in the patch.

Tested x86_64-pc-linux-gnu, applied to trunk.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]