[PATCH] D33424: Lexer: allow imaginary constants in GNU mode (only).

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 15:06:52 PDT 2017


On 24 May 2017 at 14:35, Marshall Clow via Phabricator via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> mclow.lists added a comment.
>
> This broke a libc++ test.  The following is expected to fail to compile:
>
>   #include <complex>
>   #include <cassert>
>
>   int main()
>   {
>       std::complex<float> foo  = 1.0if;  // should fail w/conversion
> operator not found
>   }
>
> when build as C++1z


I think this is expected. Clang has an extension where it treats 1.0if as a
_Complex float if no operator""if is available; libc++ has an extension
where std::complex<float> can be initialized from _Complex float. For the
same reason, that code has historically worked in C++11 and C++98 modes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170524/6dc01b76/attachment.html>


More information about the cfe-commits mailing list