From 130cc52a42e09cc40bbb13f9210cef8ae09abef6 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 8 Oct 2026 17:08:14 +0200 Subject: [PATCH 1/7] Update testio.cpp --- test/testio.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/testio.cpp b/test/testio.cpp index ad95345e1fd..6e96d075320 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -3497,9 +3497,8 @@ class TestIO : public TestFixture { "void f(E e) {\n" " printf(\"%lu\", e);\n" "}\n"); - TODO_ASSERT_EQUALS("[test.cpp:3]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'uint8_t'.\n", - "", - errout_str()); + ASSERT_EQUALS("[test.cpp:3]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'unsigned char'.\n", + errout_str()); check("void f() {\n" " printf(\"%lu\", sizeof(char));\n" From ad8a76d4cfd3924a80a97a6a0237bff25a9ddb14 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 8 Oct 2026 17:09:00 +0200 Subject: [PATCH 2/7] Update testcondition.cpp --- test/testcondition.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 4d989804b36..c417ac209e6 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -6650,6 +6650,13 @@ class TestCondition : public TestFixture { "[test.cpp:2:28]: (style) Comparing expression of type 'signed int' against value 2147483647. Condition is always false. [compareValueOutOfTypeRangeError]\n" "[test.cpp:7:17]: (style) Comparing expression of type 'signed int' against value 2147483647. Condition is always false. [compareValueOutOfTypeRangeError]\n", errout_str()); + + check("enum E : std::uint8_t {};\n" // #11243 + "void f(E e) {\n" + " if (e == 256) {}\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:3:14]: (style) Comparing expression of type 'unsigned char' against value 256. Condition is always false. [compareValueOutOfTypeRangeError]\n", + errout_str()); } void knownConditionCast() { From 4125d4b82d658b4ee9348a1ae0db79c41636860e Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 8 Oct 2026 17:11:16 +0200 Subject: [PATCH 3/7] Update symboldatabase.cpp --- lib/symboldatabase.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index c2ce2db812b..1e682328f24 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -7550,10 +7550,13 @@ static const Token* parsedecl(const Token* type, else if (valuetype->typeScope->type == ScopeType::eEnum) { const Token * enum_type = valuetype->typeScope->enumType; if (enum_type) { + ValueType evt; if (enum_type->isSigned()) valuetype->sign = ValueType::Sign::SIGNED; else if (enum_type->isUnsigned()) valuetype->sign = ValueType::Sign::UNSIGNED; + else if (!enum_type->isStandardType() && parsedecl(enum_type, &evt, defaultSignedness, settings)) + *valuetype = evt; else valuetype->sign = defaultSignedness; // TODO: this is implementation-dependent might be separate from char const ValueType::Type t = ValueType::typeFromString(enum_type->str(), enum_type->isLong()); @@ -7727,12 +7730,8 @@ static const Token* parsedecl(const Token* type, } else if (!valuetype->typeScope && (type->str() == "struct" || type->str() == "enum") && valuetype->type != ValueType::Type::SMART_POINTER) valuetype->type = type->str() == "struct" ? ValueType::Type::RECORD : ValueType::Type::NONSTD; else if (!valuetype->typeScope && type->type() && type->type()->classScope && valuetype->type != ValueType::Type::SMART_POINTER) { - if (type->type()->classScope->type == ScopeType::eEnum) { - valuetype->sign = ValueType::Sign::SIGNED; - valuetype->type = getEnumType(type->type()->classScope, settings.platform); - } else { + if (type->type()->classScope->type != ScopeType::eEnum) valuetype->type = ValueType::Type::RECORD; - } valuetype->typeScope = type->type()->classScope; } else if (type->isName() && valuetype->sign != ValueType::Sign::UNKNOWN_SIGN && valuetype->pointer == 0U) return nullptr; From 8add06a3ee59cb7f44e1597f8ca3a1e4295e07d4 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Fri, 9 Oct 2026 22:26:47 +0200 Subject: [PATCH 4/7] Fix --- lib/symboldatabase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 1e682328f24..10e6855d7a0 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -7730,8 +7730,14 @@ static const Token* parsedecl(const Token* type, } else if (!valuetype->typeScope && (type->str() == "struct" || type->str() == "enum") && valuetype->type != ValueType::Type::SMART_POINTER) valuetype->type = type->str() == "struct" ? ValueType::Type::RECORD : ValueType::Type::NONSTD; else if (!valuetype->typeScope && type->type() && type->type()->classScope && valuetype->type != ValueType::Type::SMART_POINTER) { - if (type->type()->classScope->type != ScopeType::eEnum) + if (type->type()->classScope->type == ScopeType::eEnum) { + if (valuetype->type == ValueType::Type::UNKNOWN_TYPE) { + valuetype->sign = ValueType::Sign::SIGNED; + valuetype->type = getEnumType(type->type()->classScope, settings.platform); + } + } else { valuetype->type = ValueType::Type::RECORD; + } valuetype->typeScope = type->type()->classScope; } else if (type->isName() && valuetype->sign != ValueType::Sign::UNKNOWN_SIGN && valuetype->pointer == 0U) return nullptr; From 1b060fcc36ed34a1746e4e9d79cdadd9982f1b43 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Fri, 9 Oct 2026 23:21:08 +0200 Subject: [PATCH 5/7] Fix --- lib/checkclass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 0f02016bd01..a023c4c7109 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2032,7 +2032,7 @@ void CheckClassImpl::virtualDestructor() } // Check if destructor is empty and non-empty .. - if (mSettings.standards.cpp <= Standards::CPP03) { + if (mSettings.standards.cpp == Standards::CPP03) { // Find the destructor const Function *destructor = scope->getDestructor(); From f24d711689e0f86d11b2eb77a3b1213a254b6dd2 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Sat, 10 Oct 2026 00:30:52 +0200 Subject: [PATCH 6/7] Fix --- gui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 3ed37eb7b25..eff1f098394 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -400,7 +400,7 @@ void MainWindow::loadSettings() } const ReportType reportType = static_cast(mSettings->value(SETTINGS_REPORT_TYPE, static_cast(ReportType::normal)).toInt()); - mUI->mActionReportNormal->setChecked(reportType <= ReportType::normal); + mUI->mActionReportNormal->setChecked(reportType < ReportType::normal); mUI->mActionReportAutosar->setChecked(reportType == ReportType::autosar); mUI->mActionReportCertC->setChecked(reportType == ReportType::certC); mUI->mActionReportCertCpp->setChecked(reportType == ReportType::certCpp); From 0113da7b77dcad9d4f21ce486f892eff0328af50 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Sat, 10 Oct 2026 14:54:20 +0200 Subject: [PATCH 7/7] Add tests --- test/testsymboldatabase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 93bc8861e3e..b3d60f92df6 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -9799,6 +9799,9 @@ class TestSymbolDatabase : public TestFixture { ASSERT_EQUALS("signed int", typeOf("int x; a = x++;\n", "++")); ASSERT_EQUALS("signed int *", typeOf("enum AB {A,B}; AB *ab; x=ab+2;\n", "+")); ASSERT_EQUALS("signed int *", typeOf("enum AB {A,B}; enum AB *ab; x=ab+2;\n", "+")); + ASSERT_EQUALS("unsigned char", typeOf("enum E : std::uint8_t {}; E e;\n", "e")); + ASSERT_EQUALS("signed short", typeOf("enum E : short {}; E e;\n", "e")); + TODO_ASSERT_EQUALS("unsigned short", "", typeOf("enum E : unsigned short {}; E e;\n", "e")); ASSERT_EQUALS("AB *", typeOf("struct AB {int a; int b;}; AB ab; x=&ab;\n", "&")); ASSERT_EQUALS("AB *", typeOf("struct AB {int a; int b;}; struct AB ab; x=&ab;\n", "&")); ASSERT_EQUALS("A::BC *", typeOf("namespace A { struct BC { int b; int c; }; }; struct A::BC abc; x=&abc;\n", "&"));