C++ Logo

std-discussion

Advanced search

Re: What is the reason of one rule of C++ ?

From: Tam S. B. <cpplearner_at_[hidden]>
Date: Sun, 12 Nov 2023 11:31:24 +0000
CWG 1261<https://cplusplus.github.io/CWG/issues/1261> added the sentence:

> If a prvalue initially has the type “cv T,” where T is a cv-unqualified non-class, non-array type, the type of the expression is adjusted to T prior to any further analysis.

But the idea has a much longer history. The draft standard in September 1994<https://www.open-std.org/jtc1/sc22/wg21/docs/wp/html/sep94/basic.html#basic.lval> mentions in section [basic.lval] that:

> Class rvalues may have qualified types; non-class rvalues always have unqualified types.

In the May 1994 draft standard<https://www.open-std.org/jtc1/sc22/wg21/docs/wp/txt/may94/body.txt>, this is phrased as:

> Rvalues may be qualified types, however the unqualified type is used unless the rvalue is of class type and a member function is called on the rvalue.


Received on 2023-11-12 11:31:27