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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to