I was able to reduce the bug to this:

struct A {

  A(int (&)[1]);

};

template <int (*F)(A)>

int E() {

  int X[] = {0};

  return F(X);

}


Note that the array is not empty and we are not using variadics anymore.
The problem seems to be related to the function pointer template parameter.
gcc doesn't want to do the implicit conversion from X to A, but if I make
the conversion explicit it works.


On Fri, Mar 25, 2016 at 1:58 PM, Alexey Samsonov <vonos...@gmail.com> wrote:

>
> On Fri, Mar 25, 2016 at 10:55 AM, David Blaikie via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>>
>> On Fri, Mar 25, 2016 at 10:46 AM, Samuel Benzaquen via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: sbenza
>>> Date: Fri Mar 25 12:46:02 2016
>>> New Revision: 264428
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=264428&view=rev
>>> Log:
>>> [ASTMatchers] Fix build for VariadicFunction.
>>>
>>> Under some conditions the implicit conversion from array to ArrayRef<>
>>> is not working.
>>>
>>
>> Any idea what those conditions are?
>>
>
> This was causing the build failure with opt GCC. I will try to create a
> smaller reproducer later today.
>
>
>>
>>
>>> Fix the build by making it explicit.
>>>
>>> Modified:
>>>     cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>>>
>>> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=264428&r1=264427&r2=264428&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
>>> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Fri Mar 25
>>> 12:46:02 2016
>>> @@ -90,7 +90,7 @@ private:
>>>    // before we make the array.
>>>    template <typename... ArgsT> ResultT Execute(const ArgsT &... Args)
>>> const {
>>>      const ArgT *const ArgsArray[] = {&Args...};
>>> -    return Func(ArgsArray);
>>> +    return Func(ArrayRef<const ArgT *>(ArgsArray, sizeof...(ArgsT)));
>>>    }
>>>  };
>>>
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
>
> --
> Alexey Samsonov
> vonos...@gmail.com
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to