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: unassignedclangb...@nondot.org
          Reporter: tangyix...@mail.dlut.edu.cn
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to