File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1385,6 +1385,9 @@ static bool canBeConst(const Variable *var)
13851385 if (!argVar|| (!argVar->isConst () && argVar->isReference ()))
13861386 return false ;
13871387 }
1388+ } else if (parent->str () == " &" && !parent->astOperand2 ()) {
1389+ // TODO: check how pointer is used
1390+ return false ;
13881391 } else if (parent->isConstOp ())
13891392 ;
13901393 else if (parent->isAssignmentOp ()) {
Original file line number Diff line number Diff line change @@ -1557,6 +1557,12 @@ class TestOther : public TestFixture {
15571557 " }" );
15581558 ASSERT_EQUALS (" " , errout.str ());
15591559
1560+ check (" void foo(std::string* str);\n "
1561+ " void f(std::string str) {\n "
1562+ " foo(&str);\n "
1563+ " }" );
1564+ ASSERT_EQUALS (" " , errout.str ());
1565+
15601566 check (" void foo(int& i1, const std::string& str, int& i2);\n "
15611567 " void f(std::string str) {\n "
15621568 " foo((a+b)*c, str, x);\n "
You can’t perform that action at this time.
0 commit comments