Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[BUG] Wrong error message for variable left uninitialized #1288

Open

Description

Title: Wrong error message for variable left uninitialized.

Description:

This change might have to do with commit 797569a.
There need to be regression tests for all of cppfront's diagnostics.

Minimal reproducer (https://cpp2.godbolt.org/z/MzqbWKzM9):

main: () = {
  x: int;
}
Commands:
cppfront main.cpp2
clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -Werror=unused-value -Werror=unused-parameter -Werror=unused-variable -I . main.cpp

Expected result: A diagnostic about x never being initialized.

Actual result and error:

Output:
main.cpp2...
main.cpp2(2,3): error: local variable x is used before it was initialized
  ==> program violates initialization safety guarantee - see previous errors

Activity

  1. ghost added
    bug
    on Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions