]> granicus.if.org Git - clang/commit
Reapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.
authorTim Northover <tnorthover@apple.com>
Wed, 9 Aug 2017 14:56:48 +0000 (14:56 +0000)
committerTim Northover <tnorthover@apple.com>
Wed, 9 Aug 2017 14:56:48 +0000 (14:56 +0000)
commit442707be84f5e5b20bf3d489a2d1423c8f06b4eb
tree3390f047516676710e24c6e4efa36a2e7d2f8c30
parent8a6b859dbc103eda94a2df347385ccc553a8d081
Reapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.

C++14 added user-defined literal support for complex numbers so that you
can write something like "complex<double> val = 2i". However, there is
an existing GNU extension supporting this syntax and interpreting the
result as a _Complex type.

This changes parsing so that such literals are interpreted in terms of
C++14's operators if an overload is present but otherwise falls back to
the original GNU extension.

(We now have more robust diagnostics for implicit conversions so the
libc++ test that caused the original revert still passes).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310478 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticLexKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Lex/LiteralSupport.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaLookup.cpp
test/SemaCXX/imaginary-constants.cpp [new file with mode: 0644]