Open aperezdc opened 1 week ago
For reference, the WebKit build was configured with:
CC=clang CXX=clang++ \
PATH="/opt/clang/latest/bin:$PATH" \
cmake -DPORT=GTK -DCMAKE_INSTALL_PREFIX=$HOME/.prefix/webkitgtk4 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release \
-DENABLE_SPEECH_SYNTHESIS=OFF -GNinja -Bbuild-gtk4
@aperezdc and I had a bit more of a look at that, this is the reduced test case we come up (using cvise and clang from the release/19.x and an interestingness script that is seeking the "The capture ready lambda for a potential capture can only be" error message. Because of this, other aspects of the input may of course have been broken along the way.
This produces the following minimised test case:
constexpr int value;
template <typename _Tp> _Up __declval;
template < typename _Tp > auto declval (__declval< _Tp >(0);
template < typename > struct __result_of_success;
template < bool, bool, typename... > struct __result_of_impl;
template < typename _Fn> __result_of_success< decltype(declval< _Fn >) > _S_test;
template < typename _Functor, typename... _ArgTypes > struct __result_of_impl< false, false, _Functor, _ArgTypes... > {
using type = decltype(_S_test<_Functor>); }
template < typename _Functor > struct __invoke_result : __result_of_impl< value, value, _Functor > ;
template < typename _Tp > _Tp forward();
template < typename _Callable> invoke_result_t< _Callable > invoke( _Callable ;
template < class A > struct Visitor : A struct Range { }
All;
template < typename T > struct Point { T y };
template < typename T > struct Size { T height0 };
template < Range = All > struct LengthPercentageValue { template < typename F > auto visit(F) { invoke(forward< F >());
}
template <typename... F> auto switchOn(F...) {
Visitor<F...> __trans_tmp_1;
visit(__trans_tmp_1)
}
}
;
template <Range = All>
struct LengthPercentage {
LengthPercentageValue<> value;
} template <auto aR, auto bR>
auto reflectSum(LengthPercentage<aR> a,
LengthPercentage<bR>) {
auto resultR(bR);
a.value.switchOn(
[&](auto) -> LengthPercentage<resultR> {
});
}
struct Xywh {
using Location = Point<LengthPercentage<>>;
using Size = Size<LengthPercentage<>>;
Location location;
Size size;
namespace;
Xywh operator0_value auto operator0() {
auto location(
operator0_value.location) auto
size(operator0_value.size);
reflectSum(location.y, size.height)
I can confirm that the assert is hit in a current (or at least, as of this morning) HEAD clang.
I'll set off another reduction over night with an interestingness test that rejects inputs that produce additional errors.
Based on the last snippet, it looks like it started in clang-18: https://godbolt.org/z/Mozff8nGj
So if we think there is another clang-19 specific regression then we need more of a reduction.
@cor3ntin the first possible not minimal reproducer regression looks like is caused by 3ed9e9e3ace6f9ce320cf4e75cffa04a7c7241b5
@llvm/issue-subscribers-clang-frontend
Author: Adrian Perez (aperezdc)
Here's a better reproducer (using an interestingness test that discards transformations that introduce errors this time):
template <typename _Tp, typename _Up = _Tp> _Up __declval(int);
template <typename _Tp> auto declval() -> decltype(__declval<_Tp>(0));
template <typename _Tp> using decay_t = _Tp;
template <typename _Tp> _Tp forward();
template <class...> struct Visitor;
template <class A> struct Visitor<A> : A {};
template <class... F> Visitor<F...> makeVisitor(F...);
namespace CSS {
template <typename> struct Point {};
template <typename> struct Size {};
struct Range {
} All;
template <typename T>
concept RawNumeric = requires(T raw) { raw; };
template <Range> struct LengthPercentageRaw;
template <RawNumeric> struct PrimitiveNumeric;
template <Range R = All>
using LengthPercentage = PrimitiveNumeric<LengthPercentageRaw<R>>;
}
template <typename> struct ToStyle;
template <typename T> struct Point {
T y();
};
template <typename T> struct Size {
T height();
};
int toStyle_builderState, toStyle_symbolTable;
template <typename CSSType> auto toStyle(const CSSType &cssType) {
return ToStyle<CSSType>{}(cssType, toStyle_builderState, toStyle_symbolTable);
}
template <typename CSSType>
using StyleType = decay_t<decltype(toStyle(declval<CSSType &>()))>;
template <typename CSSType> struct ToStyle<CSS::Point<CSSType>> {
auto operator()(CSS::Point<CSSType>, int, int) {
return Point<StyleType<CSSType>>{};
}
};
template <typename CSSType> struct ToStyle<CSS::Size<CSSType>> {
auto operator()(CSS::Size<CSSType>, int, int) {
return Size<StyleType<CSSType>>{};
}
};
template <CSS::Range = CSS::All> struct LengthPercentageValue {
template <typename... F> auto switchOn(F...) {
Visitor<F...> __trans_tmp_3 = makeVisitor(forward<F>()...)(__trans_tmp_3);
}
};
template <CSS::Range = CSS::All> struct LengthPercentage {
LengthPercentageValue<> value;
};
template <auto aR, auto bR>
auto reflectSum(LengthPercentage<aR>, LengthPercentage<bR> b) {
auto resultR(bR);
b.value.switchOn([&](auto) -> LengthPercentage<resultR> {});
}
namespace CSS {
struct Xywh {
using Location = Point<LengthPercentage<>>;
using Size = Size<LengthPercentage<>>;
Location location;
Size size;
};
}
template <> struct ToStyle<CSS::Xywh> {
auto operator()(const CSS::Xywh &, const int &, const int &) -> int;
};
template <auto R> struct ToStyle<CSS::LengthPercentage<R>> {
using From = CSS::LengthPercentage<>;
using To = LengthPercentage<>;
auto operator()(const From &, int, int) -> To;
};
auto ToStyle<CSS::Xywh>::operator()(const CSS::Xywh &value, const int &,
const int &) -> int {
auto location = toStyle(value.location);
auto size = toStyle(value.size);
reflectSum(location.y(), size.height())
This was found building WebKitGTK at commit https://github.com/WebKit/WebKit/commit/d9758a8fd190860ac6c4a468dfdea906786530e5
Clang was built using this PKGBUILD for Arch Linux.
Stack dump:
I have zipped the source and run script because the source is huge and GitHub wouldn't take it otherwise: source-and-runscript.zip