diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-12 17:51:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-12 17:51:55 +0000 |
commit | f7ecc3016e6309a092493070d071489516b273c0 (patch) | |
tree | f17c06eb66e44d1a8ac8c9e43fabe528ff3ae719 /test/SemaCXX | |
parent | 99850388609234e01901e316bca6ca6ffbd09337 (diff) |
Compute standard conversion sequences for conversions to atomic
types. The second and third conversions in the sequence are based on
the conversion for the underlying type, so that we get sensible
overloading behavior for, e.g., _Atomic(int) vs. _Atomic(float).
As part of this, actually implement the lvalue-to-rvalue conversion
for atomic types. There is probably a pile of code in SemaExpr that
can now be deleted, but I haven't tracked it down yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154596 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/atomic-type.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/atomic-type.cxx b/test/SemaCXX/atomic-type.cxx index adaff2a0a2..18707eb8c5 100644 --- a/test/SemaCXX/atomic-type.cxx +++ b/test/SemaCXX/atomic-type.cxx @@ -10,3 +10,26 @@ template<typename T> struct user { }; user<int> u; + +// Test overloading behavior of atomics. +struct A { }; + +int &ovl1(_Atomic(int)); +long &ovl1(_Atomic(long)); +float &ovl1(_Atomic(float)); +double &ovl1(_Atomic(A const *const *)); +short &ovl1(_Atomic(A **)); + +void test_overloading(int i, float f, _Atomic(int) ai, _Atomic(float) af, + long l, _Atomic(long) al, A const *const *acc, + A const ** ac, A **a) { + int& ir1 = ovl1(i); + int& ir2 = ovl1(ai); + long& lr1 = ovl1(l); + long& lr2 = ovl1(al); + float &fr1 = ovl1(f); + float &fr2 = ovl1(af); + double &dr1 = ovl1(acc); + double &dr2 = ovl1(ac); + short &sr1 = ovl1(a); +} |