diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-04-16 17:27:56 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-04-16 17:27:56 +0000 |
| commit | c76d2bda6ffc092b4d0471dba00e2f46d2040638 (patch) | |
| tree | fb4e614a4ac653c91233915afda69210eab19710 /libcxx/test | |
| parent | e10b7b35f82a21a8d9a604f419c11aa074d288b4 (diff) | |
| download | bcm5719-llvm-c76d2bda6ffc092b4d0471dba00e2f46d2040638.tar.gz bcm5719-llvm-c76d2bda6ffc092b4d0471dba00e2f46d2040638.zip | |
addressof misbehaving for type with an implicit conversion operator to char&. This fixes http://llvm.org/bugs/show_bug.cgi?id=15754
llvm-svn: 179608
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libcxx/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp b/libcxx/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp index 3f1bef16a3f..e07bec4d0a4 100644 --- a/libcxx/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp +++ b/libcxx/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp @@ -19,8 +19,17 @@ struct A void operator&() const {} }; +struct nothing { + operator char&() + { + static char c; + return c; + } +}; + int main() { + { int i; double d; assert(std::addressof(i) == &i); @@ -30,4 +39,13 @@ int main() assert(std::addressof(*tp) == tp); assert(std::addressof(*ctp) == tp); delete tp; + } + { + union + { + nothing n; + int i; + }; + assert(std::addressof(n) == (void*)std::addressof(i)); + } } |

