GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — added `constness_ptr` as pointer wrapper to ensure actual method constness by firewave · Pull Request #548 · cppcheck-opensource/simplecpp

Conversation

@firewave

@firewave firewave commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@firewave

firewave commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator Author

Taken from cppcheck-opensource/cppcheck#4785.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave firewave mentioned this pull request Sep 24, 2025
added constness_ptr as pointer wrapper to ensure actual method constness cppcheck-opensource/cppcheck#4785
Draft
@firewave

firewave commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator Author

I might spin out the class into a separate repo (as public domain) as this seems like something useful in general.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave
firewave force-pushed the constness branch 2 times, most recently from 5909db5 to c3ded0d Compare September 25, 2025 06:27
@firewave

firewave commented Sep 25, 2025

Copy link
Copy Markdown
Collaborator Author

This fails to compile with GCC before 15:

simplecpp.cpp:1742:37: error: operands to ‘?:’ have different types ‘const simplecpp::constness_ptr<simplecpp::Token>’ and ‘std::nullptr_t’
 1742 |                 valueToken = argtok ? argtok->next : nullptr;
      |                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

And with Visual Studio:

     6>C:\a\simplecpp\simplecpp\simplecpp.cpp(1742,54): error C2446: ':': no conversion from 'nullptr' to 'const simplecpp::constness_ptr<simplecpp::Token>' [C:\a\simplecpp\simplecpp\simplecpp_obj.vcxproj]
             C:\a\simplecpp\simplecpp\simplecpp.cpp(1742,54):
             Constructor for class 'simplecpp::constness_ptr<simplecpp::Token>' is declared 'explicit'
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave firewave mentioned this pull request Sep 27, 2025
clang-tidy.yml: updated to Clang 21 #421
Merged
@firewave
firewave force-pushed the constness branch from cc4f3f7 to b00c042 Compare October 19, 2025 15:12
@firewave
firewave force-pushed the constness branch from b00c042 to ff8e9e3 Compare December 4, 2025 13:03
@firewave

firewave commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator Author

We do not actually need to actually implement the class. As this is a compile-time check it would be enough to have a simple wrapper which does nothing and having a compile-time switch which makes it an alias for std::experimental::propagate_const.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave
added constness_ptr as pointer wrapper to ensure actual method cons…
4c1c116
…tness
@firewave
firewave force-pushed the constness branch 2 times, most recently from 02f2e36 to faaf570 Compare June 3, 2026 09:06
@firewave
adjusted suppressions for misc-const-correctness clang-tidy warning
2e28fbd
@firewave
firewave force-pushed the constness branch from faaf570 to 2e28fbd Compare June 5, 2026 08:20
@firewave firewave mentioned this pull request Jul 8, 2026
Fix 15102: Make copy-constructible classes copyable cppcheck-opensource/cppcheck#8705
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@firewave
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.