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

Template with explicit instantiation causes constructor precondition to fail #6

Open
PeterBindels-TomTom opened this issue Oct 14, 2024 · 1 comment

Comments

@PeterBindels-TomTom
Copy link

template <size_t bits>
class t {
  explicit t(std::span<const uint8_t> f) pre(f.size() == bits/8);
};

template <>
t<128>::t(std::span<const uint8_t> f) {}

Does not want to reduce much further than this. It turns out that the explicit instantiation is required for this to trigger, but I have no idea why.

@EricWF
Copy link
Member

EricWF commented Oct 14, 2024

Does not want to reduce much further than this. It turns out that the explicit instantiation is required for this to trigger, but I have no idea why.

I think that's an explicit specialization, rather than instantiation.

The explicit instantiation "works", but also this test case shook out like 3 more bugs:

https://godbolt.org/z/dEf75dG9d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants