On 30/10/2017 19:15, Jonathan Wakely wrote: > >>> @@ -1227,7 +1227,12 @@ class Printer(object): >>>    def add_version(self, base, name, function): >>>        self.add(base + name, function) >>>        if _versioned_namespace: >>> -            self.add(base + _versioned_namespace + name, function) >>> +            vbase = re.sub('^std::', 'std::%s' % >>> _versioned_namespace, base) >>> +            if vbase != base: >>> +                self.add(vbase + name, function) >>> +            vbase = re.sub('^__gnu_cxx::', '__gnu_cxx::%s' % >>> _versioned_namespace, base) >>> +            if vbase != base: >>> +                self.add(vbase + name, function) >> >> Only one re.sub is needed: >> >> vbase = re.sub('^(std|__gnu_cxx)::', r'\1::%s' % >> _versioned_namespace, base) > > Or using \g<0> to refer to the whole match: > > vbase = re.sub('^(std|__gnu_cxx)::', r'\g<0>%s' % > _versioned_namespace, base) > >> OK for trunk with that change, assuming it works. Thanks. It worked, attached patch applied. François