Skip to content

Template deduction fails with defaulted argument that's an index_sequence #42102

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 42757
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@ecatmur,@zygoloid

Extended Description

Reduced from StackOverflow (https://stackoverflow.com/q/57206006/2069064):

#include
#include

template <std::size_t S, class=std::make_index_sequence>
struct FooList;
template <std::size_t S, std::size_t... Idxs>
struct FooList<S, std::integer_sequence<std::size_t, Idxs...>> { };

template <std::size_t S>
void foobar(FooList) { }

void test() {
foobar(FooList<5>{});
}

This fails to compile on clang, the candidate is rejected with the note:

candidate template ignored: could not match '__make_integer_seq' against 'integer_sequence'

Even though these are the same type. This compiles on gcc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions