Skip to content

template type deduction handled improperly with implicit overload resolution #42632

@compnerd

Description

@compnerd
Bugzilla Link 43287
Version trunk
OS All
CC @dwblaikie,@DougGregor,@zygoloid

Extended Description

I believe that clang is handling template type deduction improperly for forward declarations of templates with overload resolution. Consider the following:

#include <type_traits>

template<typename U>
int f(const U t);

int v;
auto test = f(v);

template<typename U>
int f(U t) {
  static_assert(!std::is_const<decltype(t)>::value, "t should be non-const");
  return 0;
}

GCC correctly identifies this as int rather than const int. I believe that the type information is being preserved from the canonical decl from which this overload is being referenced. This was reduced from another test case which results in an invalid function call.

Sorry, I couldn't really come up with a good summary

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"waiting-for-wg21Blocked on C++ Standards Committee

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions