2018-08-02 05:20:58 +08:00
|
|
|
// RUN: %clang_cc1 %s -emit-llvm-only -o -
|
[AST] CastExpr: BasePathSize is not large enough.
Summary:
rC337815 / D49508 had to cannibalize one bit of `CastExprBitfields::BasePathSize` in order to squeeze `PartOfExplicitCast` boolean.
That reduced the maximal value of `PartOfExplicitCast` from 9 bits (~512) down to 8 bits (~256).
Apparently, that mattered. Too bad there weren't any tests.
It caused [[ https://bugs.llvm.org/show_bug.cgi?id=38356 | PR38356 ]].
So we need to increase `PartOfExplicitCast` back at least to 9 bits, or a bit more.
For obvious reasons, we can't do that in `CastExprBitfields` - that would blow up the size of every `Expr`.
So we need to either just add a variable into the `CastExpr` (as done here),
or use `llvm::TrailingObjects`. The latter does not seem to be straight-forward.
Perhaps, that needs to be done not for the `CastExpr` itself, but for all of it's `final` children.
Reviewers: rjmccall, rsmith, erichkeane
Reviewed By: rjmccall
Subscribers: bricci, hans, cfe-commits, waddlesplash
Differential Revision: https://reviews.llvm.org/D50050
llvm-svn: 338489
2018-08-01 14:06:16 +08:00
|
|
|
|
|
|
|
// https://bugs.llvm.org/show_bug.cgi?id=38356
|
|
|
|
// We only check that we do not crash.
|
|
|
|
|
2019-08-29 06:38:36 +08:00
|
|
|
// This test can exceed stack usage in some configurations, so unless we can
|
|
|
|
// properly handle that don't run it.
|
|
|
|
// REQUIRES: thread_support
|
2018-11-06 10:16:28 +08:00
|
|
|
|
[AST] CastExpr: BasePathSize is not large enough.
Summary:
rC337815 / D49508 had to cannibalize one bit of `CastExprBitfields::BasePathSize` in order to squeeze `PartOfExplicitCast` boolean.
That reduced the maximal value of `PartOfExplicitCast` from 9 bits (~512) down to 8 bits (~256).
Apparently, that mattered. Too bad there weren't any tests.
It caused [[ https://bugs.llvm.org/show_bug.cgi?id=38356 | PR38356 ]].
So we need to increase `PartOfExplicitCast` back at least to 9 bits, or a bit more.
For obvious reasons, we can't do that in `CastExprBitfields` - that would blow up the size of every `Expr`.
So we need to either just add a variable into the `CastExpr` (as done here),
or use `llvm::TrailingObjects`. The latter does not seem to be straight-forward.
Perhaps, that needs to be done not for the `CastExpr` itself, but for all of it's `final` children.
Reviewers: rjmccall, rsmith, erichkeane
Reviewed By: rjmccall
Subscribers: bricci, hans, cfe-commits, waddlesplash
Differential Revision: https://reviews.llvm.org/D50050
llvm-svn: 338489
2018-08-01 14:06:16 +08:00
|
|
|
template <typename a, a b(unsigned), int c, unsigned...>
|
|
|
|
struct d : d<a, b, c - 1> {};
|
|
|
|
template <typename a, a b(unsigned), unsigned... e>
|
|
|
|
struct d<a, b, 0, e...> {
|
|
|
|
a f[0];
|
|
|
|
};
|
|
|
|
struct g {
|
|
|
|
static g h(unsigned);
|
|
|
|
};
|
|
|
|
struct i {
|
|
|
|
void j() const;
|
|
|
|
// Current maximum depth of recursive template instantiation is 1024,
|
|
|
|
// thus, this \/ threshold value is used here. BasePathSize in CastExpr might
|
|
|
|
// not fit it, so we are testing that we do fit it.
|
|
|
|
// If -ftemplate-depth= is provided, larger values (4096 and up) cause crashes
|
|
|
|
// elsewhere.
|
|
|
|
d<g, g::h, (1U << 10U) - 2U> f;
|
|
|
|
};
|
|
|
|
void i::j() const {
|
|
|
|
const void *k{f.f};
|
|
|
|
(void)k;
|
|
|
|
}
|