Skip to content

Commit b8991ba

Browse files
Add test for #9981
1 parent 73c9967 commit b8991ba

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎test/testclass.cpp‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7028,6 +7028,18 @@ class TestClass : public TestFixture {
70287028
" }\n"
70297029
"};\n");
70307030
ASSERT_EQUALS("", errout_str());
7031+
7032+
checkConst("struct A {\n" // #9981
7033+
" int a = 0;\n"
7034+
" auto operator[](int x) -> int& {\n"
7035+
" a = 1;\n"
7036+
" return a;\n"
7037+
" }\n"
7038+
" int f() {\n"
7039+
" return (*this)[0];\n"
7040+
" }\n"
7041+
"};\n");
7042+
ASSERT_EQUALS("", errout_str());
70317043
}
70327044

70337045
void const102() {

0 commit comments

Comments
 (0)