Skip to content

Add explicit inline to constexpr namespace variables #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

vbaderks
Copy link
Contributor

The C++17 specs are not very clear, but inline is not implicit for a constexpr namespace variable. Add it explicit to ensure no ODR violations.

The C++17 specs are not very clear, but inline is not implicit for a constexpr namespace variable. Add it explicit to ensure no ODR violations.
Copy link

@vbaderks vbaderks requested a review from Copilot July 29, 2025 19:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds explicit inline specifiers to constexpr namespace variables to prevent potential ODR (One Definition Rule) violations. The C++17 specification is unclear about whether inline is implicit for constexpr namespace variables, so this change makes it explicit for safety.

Key changes:

  • Added inline keyword to all constexpr namespace-scope variable declarations
  • Reordered include statements in one header file for consistency
  • Removed references to a module interface file from Visual Studio project files

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/scan_codec.hpp Added inline to constexpr array J and reordered includes
src/jpeg_marker_code.hpp Added inline to three constexpr variables
src/constants.hpp Added inline to all constexpr constant declarations
src/CharLS.vcxproj.filters Removed reference to charls.ixx module file
src/CharLS.vcxproj Removed reference to charls.ixx module file
CharLS.sln.DotSettings Updated code analysis settings

@vbaderks vbaderks merged commit 0d50706 into main Jul 29, 2025
34 checks passed
@vbaderks vbaderks deleted the inline-constexpr branch July 29, 2025 19:58
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