This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34023] Wrong using of user-defined conversion operator for converting rvalue to reference on constant.
- From: "sergey dot gcc at comrades dot id dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Nov 2007 01:14:09 -0000
- Subject: [Bug c++/34023] Wrong using of user-defined conversion operator for converting rvalue to reference on constant.
- References: <bug-34023-12808@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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