https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85648
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 ICC. --- #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> vector<decltype(std::sqrt(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: _Z1fIfE6vectorIDTcl7declvalIT_EEEERKS0_IS1_ERKS1_ _Z4sqrtIfE6vectorIDTcl4sqrtcvT__EEEERKS0_IS1_E which are demangled by c++filt as: vector<decltype ((declval<float>)())> f<float>(vector<float> const&, float const&) vector<decltype (sqrt((float)()))> sqrt<float>(vector<float> const&) while both clang and icc mangle the names including the namespaces: _Z1fIfE6vectorIDTclsr3stdE7declvalIT_EEEERKS0_IS1_ERKS1_ _Z4sqrtIfE6vectorIDTclsr3stdE4sqrtcvT__EEEERKS0_IS1_E and c++filt fails to demangle these symbols.