Boost logo

Boost :

Subject: Re: [boost] [type traits extension] test for const volatile& as return type
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-07-18 14:28:55

Frédéric Bron wrote:
> Here are other parts of the standard:
> § 13.3.2 Viable functions:
> "for F to be a viable function, there shall exist for each
> argument an implicit conversion sequence
> ( that converts that argument to the corresponding
> parameter of F. If the parameter has reference
> type, the implicit conversion sequence includes the operation
> of binding the reference, and the fact that a
> reference to non-const cannot be bound to an rvalue can affect
> the viability of the function (see"
> §
> "A standard conversion sequence cannot be formed if it requires
> binding a reference to non-const to an
> rvalue (except when binding an implicit object parameter; see
> the special rules for that case in 13.3.1).
> [Note: this means, for example, that a candidate function
> cannot be a viable function if it has a non-const
> reference parameter (other than the implicit object parameter)
> and the corresponding argument is a temporary
> or would require one to be created to initialize the reference
> (see 8.5.3). ]"
> So the question is: is "const volatile &" a "reference to non-
> const"?

Were you awake into the wee hours again? "Reference to non-const" means T & or T volatile &. "const" can't be in the type.

> Or does "reference to non-const" mean exaclty T const &
> (excluding additionnal volatile qualifier) or not?

T const & is a "reference to const" so it cannot be a "reference to non-const."

> If T const volatile & is considered as "reference to non-const"
> then Intel is wrong.

It is not reference to non-const.

> If not, Intel is right.

OK, assuming there's nothing else that bears on the situation. (I haven't studied your problem, so I can't say.)

> §8.5.3/5 you quoted earlier suggests that "reference to non-
> const" is only T const & which would mean that Intel is wrong:

Did you mean to write "reference to const?"

Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP


IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Boost list run by bdawes at, gregod at, cpdaniel at, john at