diff --git a/src/script_opt/CPP/Vars.cc b/src/script_opt/CPP/Vars.cc index 4aa967c3f8..0b9efb45d9 100644 --- a/src/script_opt/CPP/Vars.cc +++ b/src/script_opt/CPP/Vars.cc @@ -111,10 +111,12 @@ string CPPCompile::LocalName(const ID* l) const { auto n = l->Name(); auto without_module = strstr(n, "::"); - if ( without_module ) - return Canonicalize(without_module + 2); - else - return Canonicalize(n); + while ( without_module ) { + n = without_module + 2; + without_module = strstr(n, "::"); + } + + return Canonicalize(n); } string CPPCompile::Canonicalize(const char* name) const {