Author: pcc Date: Mon Mar 3 13:50:01 2014 New Revision: 202749 URL: http://llvm.org/viewvc/llvm-project?rev=202749&view=rev Log: [libc++] Const qualify __gnu_cxx::hash_map<>::const_iterator::pointer type.
Differential Revision: http://llvm-reviews.chandlerc.com/D2811 Added: libcxx/trunk/test/extensions/ libcxx/trunk/test/extensions/hash_map/ libcxx/trunk/test/extensions/hash_map/const_iterator.fail.cpp Modified: libcxx/trunk/include/ext/hash_map Modified: libcxx/trunk/include/ext/hash_map URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ext/hash_map?rev=202749&r1=202748&r2=202749&view=diff ============================================================================== --- libcxx/trunk/include/ext/hash_map (original) +++ libcxx/trunk/include/ext/hash_map Mon Mar 3 13:50:01 2014 @@ -430,9 +430,9 @@ public: typedef const value_type& reference; typedef typename __pointer_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<value_type> + rebind<const value_type> #else - rebind<value_type>::other + rebind<const value_type>::other #endif pointer; Added: libcxx/trunk/test/extensions/hash_map/const_iterator.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/extensions/hash_map/const_iterator.fail.cpp?rev=202749&view=auto ============================================================================== --- libcxx/trunk/test/extensions/hash_map/const_iterator.fail.cpp (added) +++ libcxx/trunk/test/extensions/hash_map/const_iterator.fail.cpp Mon Mar 3 13:50:01 2014 @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <ext/hash_map> + +int main() +{ + __gnu_cxx::hash_map<int, int> m; + m[1] = 1; + const __gnu_cxx::hash_map<int, int> &cm = m; + cm.find(1)->second = 2; // error +} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
