================
@@ -911,6 +911,34 @@ bool Sema::CheckParameterPacksForExpansion(
// Determine the size of this argument pack.
unsigned NewPackSize, PendingPackExpansionSize = 0;
if (IsVarDeclPack) {
+
+ // if there is a function paramter pack and we directly call
findInstantiationOf
+ // then it fails because localdecls are not added to the instantiation
scope until
+ // after we check for pack expansions. So we need to check for parameter
packs here
+ // and add them to the instantiation scope before we call
findInstantiationOf.
----------------
albertbolt1 wrote:
this is the path followed for the below program
```
#include <type_traits>
#include <cstdint>
constexpr int64_t NumberOfTrueInstances(auto... booleans)
requires ((std::is_same_v<bool, decltype(booleans)>) && ...)
{
bool the_booleans[] = {booleans...};
int64_t nrvo = 0;
for (bool a_boolean : the_booleans) {
if (a_boolean) nrvo += 1;
}
return nrvo;
}
int main() {
constexpr bool a = true;
constexpr bool b = false;
constexpr bool c = true;
constexpr bool d = false;
constexpr int64_t count = NumberOfTrueInstances(a, b, c, d);
static_assert(count == 2);
}
```
https://github.com/llvm/llvm-project/pull/198207
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits