[llvm-bugs] [Bug 47175] New: [CTAD] User-defined deduction guide not found when argument type is template parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 14 19:31:55 PDT 2020


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

            Bug ID: 47175
           Summary: [CTAD] User-defined deduction guide not found when
                    argument type is template parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cebtenzzre at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following code fails to compile with clang:
```
template <typename T>
struct A
{
    int i = 42;
    A(T) {}
};

template <typename T>
A(T) -> A<T>;

template <typename T>
int foo()
{
    T x{};
    return A(x).i;
}

int y = foo<int>();
```

$ clang++ -std=c++17 -c test.cpp
test.cpp:15:16: error: member reference base type 'A' is not a structure or
union

Godbolt link: https://godbolt.org/z/fWKcro
GCC, MSVC, and ICC compile this code successfully.

-- 
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/20200815/52f13f77/attachment.html>


More information about the llvm-bugs mailing list