Skip to content

C++: Fix IR construction for implicit conversions in new initializers#20306

Merged
MathiasVP merged 3 commits intogithub:mainfrom
MathiasVP:fix-new-initializer-bug
Aug 28, 2025
Merged

C++: Fix IR construction for implicit conversions in new initializers#20306
MathiasVP merged 3 commits intogithub:mainfrom
MathiasVP:fix-new-initializer-bug

Conversation

@MathiasVP
Copy link
Copy Markdown
Contributor

What the title says 😂

@MathiasVP MathiasVP requested a review from a team as a code owner August 28, 2025 10:15
Copilot AI review requested due to automatic review settings August 28, 2025 10:15
@github-actions github-actions Bot added the C++ label Aug 28, 2025
Copy link
Copy Markdown
Contributor

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 fixes IR construction for implicit conversions in new initializers by ensuring that type conversions are properly handled when constructing the intermediate representation for new expressions with initializers.

  • Uses the fully converted expression instead of the raw initializer for new expressions
  • Adds test cases to verify proper IR generation for allocation with initializers requiring type conversion

Reviewed Changes

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

Show a summary per file
File Description
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll Modified to use getFullyConverted() on the initializer expression
cpp/ql/test/library-tests/ir/ir/ir.cpp Added test function with new expressions requiring implicit conversions
cpp/ql/test/library-tests/ir/ir/raw_ir.expected Updated expected IR output for the new test cases
cpp/ql/test/library-tests/ir/ir/aliased_ir.expected Updated expected aliased IR output for the new test cases
cpp/ql/test/library-tests/ir/ir/PrintAST.expected Updated expected AST output showing the implicit conversion

@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Aug 28, 2025
Copy link
Copy Markdown
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

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

LGTM

@MathiasVP
Copy link
Copy Markdown
Contributor Author

DCA was uneventful

@MathiasVP MathiasVP merged commit 2c2b1e4 into github:main Aug 28, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants