[cfe-dev] [libc++] c++14 return type deduction usage should be limited

Richard Smith richard at metafoo.co.uk
Tue Aug 13 12:12:27 PDT 2013


On Tue, Aug 13, 2013 at 12:03 PM, Zhihao Yuan <lichray at gmail.com> wrote:

> /usr/local/bin/clang++ -Wall -stdlib=libc++ -std=c++1y
> -I/home/lichray/devel/libcxx/include a.cc
> a.cc:33:10: error: cannot initialize return object of type 'typename
>       std::common_type<unsigned char, unsigned char>::type' (aka
> 'unsigned char') with
>       an rvalue of type 'auto'
>

This was a clang bug. There's no such thing as "an rvalue of type 'auto'".


>                 return FunctorType::operator()(t...);
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> a.cc:58:43: note: in instantiation of function template specialization
>       'stdex::operation<std::__1::bit_xor<void>,
> void>::operator()<unsigned char,
>       unsigned char>' requested here
>         assert(stdex::operation<std::bit_xor<>>()(a, b) == 'L');
>                                                  ^
> /usr/include/assert.h:54:21: note: expanded from macro 'assert'
> #define assert(e)       ((e) ? (void)0 : __assert(__func__, __FILE__, \
>                           ^
> 1 error generated.
>
> clang++ r182968. If it's a clang bug, I have to install clang again
> and try construct another test.
>
> --
> Zhihao Yuan, ID lichray
> The best way to predict the future is to invent it.
> ___________________________________________________
> 4BSD -- http://4bsd.biz/
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130813/09dd4d88/attachment.html>


More information about the cfe-dev mailing list