1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
Pull in r213790 from upstream clang trunk (by Richard Smith):
PR20228: don't retain a pointer to a vector element after the
container has been resized.
This fixes a possible crash when compiling certain parts of libc++'s
type_traits header.
Introduced here: http://svnweb.freebsd.org/changeset/base/276516
Index: tools/clang/lib/Sema/SemaExprCXX.cpp
===================================================================
--- tools/clang/lib/Sema/SemaExprCXX.cpp
+++ tools/clang/lib/Sema/SemaExprCXX.cpp
@@ -3642,12 +3642,13 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait K
if (T->isObjectType() || T->isFunctionType())
T = S.Context.getRValueReferenceType(T);
OpaqueArgExprs.push_back(
- OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
+ OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
T.getNonLValueExprType(S.Context),
Expr::getValueKindForType(T)));
- ArgExprs.push_back(&OpaqueArgExprs.back());
}
-
+ for (Expr &E : OpaqueArgExprs)
+ ArgExprs.push_back(&E);
+
// Perform the initialization in an unevaluated context within a SFINAE
// trap at translation unit scope.
EnterExpressionEvaluationContext Unevaluated(S, Sema::Unevaluated);
Index: tools/clang/test/SemaCXX/type-traits.cpp
===================================================================
--- tools/clang/test/SemaCXX/type-traits.cpp
+++ tools/clang/test/SemaCXX/type-traits.cpp
@@ -146,6 +146,10 @@ struct ThreeArgCtor {
ThreeArgCtor(int*, char*, int);
};
+struct VariadicCtor {
+ template<typename...T> VariadicCtor(T...);
+};
+
void is_pod()
{
{ int arr[T(__is_pod(int))]; }
@@ -1968,6 +1972,10 @@ void constructible_checks() {
// PR19178
{ int arr[F(__is_constructible(Abstract))]; }
{ int arr[F(__is_nothrow_constructible(Abstract))]; }
+
+ // PR20228
+ { int arr[T(__is_constructible(VariadicCtor,
+ int, int, int, int, int, int, int, int, int))]; }
}
// Instantiation of __is_trivially_constructible
|