[llvm-bugs] [Bug 43287] New: template type deduction handled improperly with implicit overload resolution

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 11 16:47:14 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43287

            Bug ID: 43287
           Summary: template type deduction handled improperly with
                    implicit overload resolution
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: compnerd at compnerd.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190911/e46e7723/attachment-0001.html>


More information about the llvm-bugs mailing list