FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Partial fix for #14982 internalAstError for noexcept function with requires clause by chrchr-github · Pull Request #8808 · cppcheck-opensource/cppcheck · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion lib/templatesimplifier.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3831,7 +3831,7 @@ void TemplateSimplifier::simplifyTemplates(const std::time_t maxtime)
// Remove concepts/requires
// TODO concepts are not removed yet
for (Token *tok = mTokenList.front(); tok; tok = tok->next()) {
if (!Token::Match(tok, ")|>|>> requires %name%|("))
if (!Token::Match(tok, ")|>|>>|const|noexcept requires %name%|("))
Comment thread
ludviggunne marked this conversation as resolved.
continue;
const Token* end = skipRequires(tok->next());
if (end)
Expand Down
17 changes: 17 additions & 0 deletions test/testsimplifytemplate.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class TestSimplifyTemplate : public TestFixture {
TEST_CASE(requires3);
TEST_CASE(requires4);
TEST_CASE(requires5);
TEST_CASE(requires6);

TEST_CASE(explicitBool1);
TEST_CASE(explicitBool2);
Expand Down Expand Up @@ -6696,6 +6697,22 @@ class TestSimplifyTemplate : public TestFixture {
ASSERT_EQUALS(expected, tok(code));
}

void requires6() {
const char code[] = "template <int N>\n" // #14982
"struct S {\n"
" static void f() noexcept\n"
" requires(N >= 5) {}\n"
" void g() const\n"
" requires(N >= 5) {}\n"
"};";
const char expected[] = "template < int N > "
"struct S { "
"static void f ( ) noexcept { } "
"void g ( ) const { } "
"} ;";
ASSERT_EQUALS(expected, tok(code));
}

void explicitBool1() {
const char code[] = "class Fred { explicit(true) Fred(int); };";
ASSERT_EQUALS("class Fred { explicit Fred ( int ) ; } ;", tok(code));
Expand Down
Loading

Back | FazBrowse Home | New Git URL