|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-01 21:52:01
"Eric Niebler" <eric_at_[hidden]> wrote in message
news:41AE786B.50306_at_boost-consulting.com...
>
> Jonathan Turkanis wrote:
> > "Eric Niebler" <eric_at_[hidden]> wrote:
> >>If anyone knows of a foolproof
> >>way to distinguish lvalues from rvalues, I'm all ears.
> >
> > Oddly enough, I was thinking about this last night, and wrote the attached
code.
> > It may be wildly wrong
> <snip>
>
> Unfortunately, it is. There is a precedence problem because the
> expression to which the macro expands is not enclosed in parens. \
Whoops! I can't believe I made that mistake.
> In your
> tests, the ! is only applied to part of the expression, leading to false
> positives.
I think it leads to true negatives. ;-) The case you're interested in is
const std::string h() { return "hello"; }
BOOST_STATIC_ASSERT(!BOOST_IS_LVALUE(h()));
which now fails, except on GCC 3.4 :( Are you sure GCC is wrong here?
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk