Skip to content

cppcoreguidelines-interfaces-global-init false positive for global references initialized from other globals #123485

@LegalizeAdulthood

Description

@LegalizeAdulthood

Suppose you have the following code:

double g_params[MAX_PARAMS]{};
static const double &LAMBDA{g_params[0]};

cppcoreguidelines-interfaces-global-init is reported for the declaration of LAMBDA, but this is erroneous.

To reproduce:

  1. git clone https://github.com/LegalizeAdulthood/iterated-dynamics.git
  2. git checkout 3f219d4dfce69d8bcab73412d0b261f378a6a239
  3. git submodule init
  4. git submodule update
  5. cmake --preset default
  6. run clang-tidy on lorenz.cpp
  7. false positive reported for lines 1295-1300

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions