[Bug demangler/85648] New: Name mangling using decltype omits namespace

guilherme at amadio dot org gcc-bugzilla@gcc.gnu.org
Fri May 4 11:49:00 GMT 2018


            Bug ID: 85648
           Summary: Name mangling using decltype omits namespace
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: demangler
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guilherme at amadio dot org
  Target Milestone: ---

The code below will yield mangled names that are inconsistent with Clang and

#include <cmath>
#include <utility>

template<typename T> class vector {};

template<typename T> 
auto f(vector<T> const& v, T const& x)
  -> vector<decltype(std::declval<T>())> { return {}; }

template auto f(vector<float> const& v, float const& x) 
  -> vector<decltype(std::declval<float>())>;

template<typename T> 
sqrt(vector<T> const& v)
{ return {}; }

template vector<decltype(std::sqrt(float()))>
sqrt(vector<float> const&);

You can also see it here: https://godbolt.org/g/ZSYUEB

gcc-7.3.0 generates these mangled names:


which are demangled by c++filt as:

vector<decltype ((declval<float>)())> f<float>(vector<float> const&, float

vector<decltype (sqrt((float)()))> sqrt<float>(vector<float> const&)

while both clang and icc mangle the names including the namespaces:


and c++filt fails to demangle these symbols.

More information about the Gcc-bugs mailing list