]> granicus.if.org Git - clang/commit
Introduce _Complex conversions into the function overloading
authorDouglas Gregor <dgregor@apple.com>
Thu, 12 Feb 2009 00:15:05 +0000 (00:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 12 Feb 2009 00:15:05 +0000 (00:15 +0000)
commit5cdf82164dd7c2b2320d6735c63ace4331e0716d
tree4625db674b908e46a593ef83f7179ccf342e248a
parentc657eba43f0159bd81227fa0812b92a0b03f00d0
Introduce _Complex conversions into the function overloading
system. Since C99 doesn't have overloading and C++ doesn't have
_Complex, there is no specification for    this. Here's what I think
makes sense.

Complex conversions come in several flavors:

  - Complex promotions:  a complex -> complex   conversion where the
    underlying real-type conversion is a floating-point promotion. GCC
    seems to call this a promotion, EDG does something else. This is
    given "promotion" rank for determining the best viable function.
  - Complex conversions: a complex -> complex conversion that is
    not a complex promotion. This is given "conversion" rank for
    determining the best viable   function.
  - Complex-real conversions: a real -> complex or complex -> real
    conversion. This is given "conversion" rank for determining the
    best viable function.

These rules are the same for C99 (when using the "overloadable"
attribute) and C++. However, there is one difference in the handling
of floating-point promotions: in C99, float -> long double and double
-> long double are considered promotions (so we give them "promotion"
rank), while C++ considers these conversions ("conversion" rank).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64343 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/Type.cpp
lib/Sema/Sema.h
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaOverload.h
test/SemaCXX/complex-overload.cpp [new file with mode: 0644]