[llvm-bugs] [Bug 47352] New: clang rejects valid code for error: no viable constructor or deduction guide for deduction

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 29 07:11:47 PDT 2020


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

            Bug ID: 47352
           Summary: clang rejects valid code for error: no viable
                    constructor or deduction guide for deduction
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                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

g++ compiles the code successfully, while clang++ rejects it.

$ cat s.cpp
template < int I > struct int_{};

template < typename T >
struct A{
    template < typename U, int I >
    struct B{
        B(U u, int_< I >){}
    };
};


int main(){
    A< int >::B v(0, int_< 0 >());
    (void)v;
}


$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
ab4627364aefcaac751e757b721b7d07b48a545a)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang++ -c s.cpp
s.cpp:13:17: error: no viable constructor or deduction guide for deduction of
template arguments of 'B'
    A< int >::B v(0, int_< 0 >());
                ^
s.cpp:6:12: note: candidate function template not viable: requires 1 argument,
but 2 were provided
    struct B{
           ^
s.cpp:6:12: note: candidate function template not viable: requires 0 arguments,
but 2 were provided
1 error generated.

-- 
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/20200829/ea56583e/attachment.html>


More information about the llvm-bugs mailing list