Fix FP constVariable with reference to std::array (#4777)
This commit is contained in:
parent
66758d65f9
commit
271ccbc8f3
|
@ -6037,7 +6037,7 @@ void SymbolDatabase::setValueType(Token* tok, const Variable& var, SourceLocatio
|
||||||
valuetype.setDebugPath(tok, loc);
|
valuetype.setDebugPath(tok, loc);
|
||||||
if (var.nameToken())
|
if (var.nameToken())
|
||||||
valuetype.bits = var.nameToken()->bits();
|
valuetype.bits = var.nameToken()->bits();
|
||||||
valuetype.pointer = var.dimensions().size();
|
valuetype.pointer = (var.valueType() && var.valueType()->container) ? 0 : var.dimensions().size();
|
||||||
valuetype.typeScope = var.typeScope();
|
valuetype.typeScope = var.typeScope();
|
||||||
if (var.valueType()) {
|
if (var.valueType()) {
|
||||||
valuetype.container = var.valueType()->container;
|
valuetype.container = var.valueType()->container;
|
||||||
|
|
|
@ -3347,6 +3347,13 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (style) Parameter 'p0' can be declared as pointer to const\n"
|
ASSERT_EQUALS("[test.cpp:1]: (style) Parameter 'p0' can be declared as pointer to const\n"
|
||||||
"[test.cpp:1]: (style) Parameter 'p1' can be declared as pointer to const\n",
|
"[test.cpp:1]: (style) Parameter 'p1' can be declared as pointer to const\n",
|
||||||
errout.str());
|
errout.str());
|
||||||
|
|
||||||
|
check("void f() {\n"
|
||||||
|
" std::array<int, 1> a{}, b{};\n"
|
||||||
|
" const std::array<int, 1>& r = a;\n"
|
||||||
|
" if (r == b) {}\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchRedundantAssignmentTest() {
|
void switchRedundantAssignmentTest() {
|
||||||
|
|
Loading…
Reference in New Issue