Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

erroneous substitution failure through a type alias on variadic template #26046

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR26047
Status NEW
Importance P normal
Reported by Eric Wallace (eric.s.wallace@intel.com)
Reported on 2016-01-06 12:21:45 -0800
Last modified on 2016-01-06 12:21:45 -0800
Version 3.6
Hardware PC Linux
CC dgregor@apple.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments bug.ii (606 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 15571
The test case from the description, but pre-processed

The following code seems to produce an erroneous substitution failure:

====

template <typename... Ts>
struct function
{
};

template <typename... Ts>
using Callback = function<void(Ts...)>;

template <typename... Ts>
void foo(Callback<Ts...> callback)
{
}

void foo_int(Callback<int> callback)
{
}

template <typename... Ts>
void foo_no_type_indirection(function<void(Ts...)> callback)
{
}

int main()
{
    Callback<int> callback = function<void(int)>{};
    foo_int(callback); // succeeds
    foo_no_type_indirection(callback); // succeeds
    foo(callback); // fails: substitution failure
    return 0;
}

====

Note that if the substitution is done by hand (the "foo_int" case), the call
succeeds. Also if we don't go through the "Callback" type alias (the
"foo_no_type_indirection" case), the call succeeds. Variadic templates are also
required here; when I tested using a single argument template, clang succeeded.

This test case compiles with gcc4.8.

There are a few other substitution failures kicking around in the bug list, but
none looked quite like this. I thought this test case might be useful even if
it turns out to be a duplicate problem.
Quuxplusone commented 8 years ago

Attached bug.ii (606 bytes, application/octet-stream): The test case from the description, but pre-processed