Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to partially specialize a class when make_index_sequence is involved #51928

Closed
llvmbot opened this issue Nov 22, 2021 · 4 comments
Closed
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 22, 2021

Bugzilla Link 52586
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

The following code fails to compile.

#include <utility>

template <typename T, typename Seq>
struct X;

template <typename T>
struct X<T, std::make_index_sequence<sizeof(T)>> {
};

X<char, std::make_index_sequence<1>> x;
// ^^^
// error: implicit instantiation of undefined template
// 'X<char, std::integer_sequence<unsigned long, 0>>

See https://godbolt.org/z/o8ejrTGKE

Replacing make_index_sequence<1> with the equivalent index_sequence<0> in the class template definition works around the issue.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@royjacobson
Copy link
Contributor

Potentially related to #42102 - there's some weirdness about __make_integer_seq and the way it's implemented as a builtin.

@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Apr 16, 2022
@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 16, 2022

@llvm/issue-subscribers-clang-frontend

@mizvekov
Copy link
Contributor

mizvekov commented Sep 4, 2022

I think the issue is that if any of the template arguments to __make_integer_seq are dependent, then we create a canonical TemplateSpecializationType of the __make_integer_seq builtin template.

We should instead create a canonical TST based on the first argument of the builtin, if that argument is not dependent.

@mizvekov
Copy link
Contributor

Fixed by: f4ea3bd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants