Topic: Should rvalues be cv-qualified ?


Author: "Piotr Dobrogost" <pbc@poczta.onet.pl>
Date: Mon, 3 Sep 2001 16:55:50 GMT
Raw View
Hi,

In Borland C++ help I have read this:

<quote>
template <class T> void func(const T)

{
   .
   .
   .
};
func(0);  // This is illegal under ANSI C++: unresolved func(int).

// However, Borland C++  allows func(const int) to be called.

</quote>

Objects created from literals are rvalues and rvalues of built-in types are
never cv-qualified (I've read this here or on c.l.c++.m). That's why
compiler can't find any good version of 'func' function. Am I right ? If so
then should rvalues of built-in types be sometimes (always ?) cv-qualified
making this example legal ? What about user types ?

Piotr Dobrogost


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]