Skip to content

[BUG] Forward declaration of deduced namespace scope variable is ill-formed #315

@JohelEGP

Description

@JohelEGP

Describe the bug

error: declaration of variable 'y' with deduced type 'auto' requires an initializer
extern auto y;
            ^

To Reproduce
Steps to reproduce the behavior:

  1. Sample code - distilled down to minimal essentials please
y := 0;
  1. Command lines including which C++ compiler you are using
~/root/bin/cppfront x.cpp2 
~/root/clang/bin/clang++ -std=c++20 -I $CPPFRONT_INCLUDE_DIR x.cpp
clang version 17.0.0
  1. Expected result - what you expected to happen
    To generate working code, if possible. Perhaps by replacing auto with decltype(initializing expression).

  2. Actual result/error

x.cpp2:1:13: error: declaration of variable 'y' with deduced type 'auto' requires an initializer
extern auto y;
            ^
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions