Skip to content

Conversation

@firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

Taken from danmar/cppcheck#4785.

@firewave
Copy link
Collaborator Author

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

@firewave firewave force-pushed the constness branch 2 times, most recently from 5909db5 to c3ded0d Compare September 25, 2025 06:27
@firewave
Copy link
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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant