| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated |
| 10 | |
| 11 | #include <ext/hash_map> |
| 12 | |
| 13 | int main(int, char**) { |
| 14 | __gnu_cxx::hash_map<int, int> m; |
| 15 | m[1] = 1; |
| 16 | const __gnu_cxx::hash_map<int, int>& cm = m; |
| 17 | cm.find(key: 1)->second = 2; // expected-error {{cannot assign to return value because function 'operator->' returns a const value}} |
| 18 | |
| 19 | return 0; |
| 20 | } |
| 21 | |