1 change: 0 additions & 1 deletion clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5897,7 +5897,6 @@ bool TreeTransform<Derived>::TransformFunctionTypeParams(
= dyn_cast<PackExpansionType>(OldType)) {
// We have a function parameter pack that may need to be expanded.
QualType Pattern = Expansion->getPattern();
NumExpansions = Expansion->getNumExpansions();
SmallVector<UnexpandedParameterPack, 2> Unexpanded;
getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded);

Expand Down
72 changes: 33 additions & 39 deletions clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,51 +473,45 @@ int fn() {
}
}

namespace pr56094 {
template <typename... T> struct D {
template <typename... U> using B = int(int (*...p)(T, U));
// expected-error@-1 {{pack expansion contains parameter packs 'T' and 'U' that have different lengths (1 vs. 2)}}
template <typename U1, typename U2> D(B<U1, U2> *);
// expected-note@-1 {{in instantiation of template type alias 'B' requested here}}
namespace GH58452 {
template <typename... As> struct A {
template <typename... Bs> using B = void(As...(Bs));
};
using t1 = D<float>::B<int>;
// expected-note@-1 {{in instantiation of template class 'pr56094::D<float>' requested here}}

template <bool...> struct F {};
template <class...> struct G {};
template <bool... I> struct E {
template <bool... U> using B = G<F<I, U>...>;
// expected-error@-1 {{pack expansion contains parameter packs 'I' and 'U' that have different lengths (1 vs. 2)}}
template <bool U1, bool U2> E(B<U1, U2> *);
// expected-note@-1 {{in instantiation of template type alias 'B' requested here}}

template <typename... Cs> struct C {
template <typename... Ds> using D = typename A<Cs...>::template B<Ds...>;
};
using t2 = E<true>::B<false>;
// expected-note@-1 {{in instantiation of template class 'pr56094::E<true>' requested here}}
} // namespace pr56094

namespace GH56094 {
#if __cplusplus >= 201402L
template <class> struct A; // expected-note {{template is declared here}}
template <class> using B = char;
template <class ...Cs> int C{ A<B<Cs>>{}... }; // expected-error {{implicit instantiation of undefined template}}
#endif
} // namespace GH56094

namespace GH58679 {
#if __cplusplus >= 201402L
template <class> constexpr int A = 1;
using t1 = C<int, int>::template D<float, float>;

template <int> struct B;
template <> struct B<1> { using b1 = void; };
template <typename A, typename B>
using ConditionalRewrite = B;

template <class> using C = char;
template <typename T>
using SignatureType = int;

template <class... Ds> int D{ B<A<C<Ds>>>{}... };
template <typename... Args>
struct Type1 {
template <typename... Params>
using Return = SignatureType<int(ConditionalRewrite<Args, Params>...)>;

struct E {
template <class E1, class = typename B<A<E1>>::b1> E(E1);
};

template <typename... Es> int F{ E(C<Es>{})... };
#endif
} // namespace GH58679
template <typename... Args>
struct Type2 {
using T1 = Type1<Args...>;

template <typename... Params>
using Return = typename T1::template Return<Params...>;

};

template <typename T>
typename T::template Return<int, int> InvokeMethod() {
return 3;
}

int Function1() {
return InvokeMethod<Type2<int, int>>();
}
}
17 changes: 17 additions & 0 deletions clang/test/Lexer/update_consecutive_macro_crash.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %clang -cc1 -fsyntax-only -verify %s 2>&1

#define X(val2) Y(val2++) // expected-note {{macro 'X' defined here}}
#define Y(expression) expression ;

void foo() {
// https://github.com/llvm/llvm-project/issues/60722:
//
// - Due to to the error recovery, the lexer inserts a pair of () around the
// macro argument int{,}, so we will see [(, int, {, ,, }, )] tokens.
// - however, the size of file id for the macro argument only takes account
// the written tokens int{,} , and the extra inserted ) token points to the
// Limit source location which triggered an empty Partition violation.
X(int{,}); // expected-error {{too many arguments provided to function-like macro invocation}} \
expected-error {{expected expression}} \
expected-note {{parentheses are required around macro argument containing braced initializer list}}
}
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace PR41845 {
template <int I> struct Constant {};

template <int... Is> struct Sum {
template <int... Js> using type = Constant<((Is + Js) + ... + 0)>; // expected-error {{pack expansion contains parameter packs 'Is' and 'Js' that have different lengths (1 vs. 2)}}
template <int... Js> using type = Constant<((Is + Js) + ... + 0)>; // expected-error {{pack expansion contains parameter pack 'Js' that has a different length (1 vs. 2) from outer parameter packs}}
};

Sum<1>::type<1, 2> x; // expected-note {{instantiation of}}
Expand Down
6 changes: 3 additions & 3 deletions clang/test/SemaTemplate/pack-deduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ namespace partial_full_mix {
template<typename ...T> struct tuple {};
template<typename ...T> struct A {
template<typename ...U> static pair<tuple<T...>, tuple<U...>> f(pair<T, U> ...p);
// expected-note@-1 {{[with U = <char, double, long>]: pack expansion contains parameter packs 'T' and 'U' that have different lengths (2 vs. 3)}}
// expected-note@-1 {{[with U = <char, double, long>]: pack expansion contains parameter pack 'U' that has a different length (2 vs. 3) from outer parameter packs}}
// expected-note@-2 {{[with U = <char, double, void>]: pack expansion contains parameter pack 'U' that has a different length (at least 3 vs. 2) from outer parameter packs}}

template<typename ...U> static pair<tuple<T...>, tuple<U...>> g(pair<T, U> ...p, ...);
// expected-note@-1 {{[with U = <char, double, long>]: pack expansion contains parameter packs 'T' and 'U' that have different lengths (2 vs. 3)}}
// expected-note@-1 {{[with U = <char, double, long>]: pack expansion contains parameter pack 'U' that has a different length (2 vs. 3) from outer parameter packs}}

template<typename ...U> static tuple<U...> h(tuple<pair<T, U>..., pair<int, int>>);
// expected-note@-1 {{[with U = <int[2]>]: pack expansion contains parameter packs 'T' and 'U' that have different lengths (2 vs. 1)}}
// expected-note@-1 {{[with U = <int[2]>]: pack expansion contains parameter pack 'U' that has a different length (2 vs. 1) from outer parameter packs}}
};

pair<tuple<int, float>, tuple<char, double>> k1 = A<int, float>().f<char>(pair<int, char>(), pair<float, double>());
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/builtins/cpu_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,9 @@ int CONSTRUCTOR_ATTRIBUTE __cpu_indicator_init(void) {
#define HWCAP_SB (1 << 29)
#endif

#ifndef AT_HWCAP2
#define AT_HWCAP2 26
#endif
#ifndef HWCAP2_DCPODP
#define HWCAP2_DCPODP (1 << 0)
#endif
Expand Down