diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-11 19:22:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-11 19:22:50 +0000 |
commit | f2e4dfcd325db2c1a960697be2c750f277dcafce (patch) | |
tree | 5b2997b51f374caa7d242f200db5200b17f86fdf /test/SemaCXX/copy-initialization.cpp | |
parent | 8327118ff60cd9c4812fba1e5ba4eb3cb5ed3401 (diff) |
Implement core issue 5: a temporary created for copy-initialization has a
cv-unqualified type. This is essential in order to allow move-only objects of
const-qualified types to be copy-initialized via a converting constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/copy-initialization.cpp')
-rw-r--r-- | test/SemaCXX/copy-initialization.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp index fb83dcfbd0..ea2db0c68e 100644 --- a/test/SemaCXX/copy-initialization.cpp +++ b/test/SemaCXX/copy-initialization.cpp @@ -42,3 +42,26 @@ namespace PR6757 { f(foo); } } + +namespace DR5 { + // Core issue 5: if a temporary is created in copy-initialization, it is of + // the cv-unqualified version of the destination type. + namespace Ex1 { + struct C { }; + C c; + struct A { + A(const A&); + A(const C&); + }; + const volatile A a = c; // ok + } + + namespace Ex2 { + struct S { + S(S&&); // expected-warning {{C++11}} + S(int); + }; + const S a(0); + const S b = 0; + } +} |