[Bug c++/34023] Wrong using of user-defined conversion operator for converting rvalue to reference on constant.

sergey dot gcc at comrades dot id dot au gcc-bugzilla@gcc.gnu.org
Fri Nov 9 01:14:00 GMT 2007



------- Comment #3 from sergey dot gcc at comrades dot id dot au  2007-11-09 01:14 -------
// Workaround:
class a
{
public:
        template<class T>
        operator T &() const
                throw(typename ::boost::disable_if<
                        ::boost::is_same<T, ref_t const> >::type *)
        {
                static int f;
                return f;
        }
};

int main()
{
        a const &aa = a(); // line # 27
        int &i = aa;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34023



More information about the Gcc-bugs mailing list