[LLVMbugs] [Bug 23904] New: Clang cannot deduce the template parameter when function parameter type is reference to array and template argument is braced-init-list

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 20 07:33:09 PDT 2015


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

            Bug ID: 23904
           Summary: Clang cannot deduce the template parameter when
                    function parameter type is reference to array and
                    template argument is  braced-init-list
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: boostcpp at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang cannot deduce the template parameter when function template's parameter
type is reference to array and template argument is braced-init-list.

void f( int (&&a)[3] ) { }

template < typename T, std::size_t N >
void g( T (&&a)[N] ) { }

template < typename T, std::size_t N >
void h( const T (&a)[N] ) { }


int main()
{
    // GCC and Clang accept it
    f( {1,2,3} ) ;

    // GCC accept it
    // Clang reject it
    // couldn't infer template argument 'T'(and 'N' too) 
    g( {1,2,3} ) ;
    h( {1,2,3} ) ;
}

I think GCC is right on here so template parameters can be deduced.

-- 
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/20150620/42bd9bf0/attachment.html>


More information about the llvm-bugs mailing list