clad icon indicating copy to clipboard operation
clad copied to clipboard

Clad is not building the nested name qualifiers correctly

Open gojakuch opened this issue 6 months ago • 5 comments

There's a plenty of examples in Kokkos unittests, for instance. Using Clad with the generate-source-file option thus produces invalid code with some nested name qualifiers missing.

Here's a reproducer:

#include "clad/Differentiator/Differentiator.h"
#include <iostream>

namespace TN {
    struct Test {
        static int multiplier;
    };
    int Test::multiplier = 3;
}

double fn(double x) {
    return TN::Test::multiplier*x;
}

int main() {
  auto df = clad::differentiate(fn, "x");
  std::cout << "f(3)=" << fn(3.0);
  std::cout << "; df(3)=" << df.execute(3.0) << '\n';
  return 0;
}

In the generated code, the TN::Test::multiplier is just used as multiplier which isn't correct.

gojakuch avatar Aug 21 '24 13:08 gojakuch