-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Clang] ICE because of decltype(args)...
in the requires
of a template friend
#114685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-frontend Author: Jared Irwin (Link1J)
The following code (which is simplify to contain what is needed for the error) compiles fine on Clang 18, but crashes Clang 19. ([godbolt](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGEgBykrgAyeAyYAHI%2BAEaYxBJmpAAOqAqETgwe3r56KWmOAqHhUSyx8Vy2mPYFDEIETMQEWT5%2BXIF2mA4ZdQ0ERZExcQm29Y3NORUKo31hA6VDXACUtqhexMjsHASYLEkG2wDUJgDMbgQAnkmMrJgHACon2CYaAIJTxF4OB0kExEcA7FZXgcQQdtrt9rcTmdLtc2Ac5I9ni9QQcqMQ8K5vr9oYjjtgDiwmABrTAAfUIOwgTC8RHMADYGQA6FkHBrABSLA4MVCYVQbH7I1Go4iYACOXjwooUEDJFIUZLQDHen0c0XoEDkpAOWGQtAuV2pxA5ixZTMWixOQJeJn%2BABErcjkeC9kxDtCDXDbninq8fsRcY9CSTyZSWNTaagGczWezOdzefzMILgaDRRKpZgZXK8AqlSquurMJrtbr9bCjSazRbHa9kf7ocgEA0g6NgJgCFaOMtaJwAKy8PzcXioThuazWA4KVbrKFmY48UgETTd5bEkBmf5MrjHPtcDTHfwATkk9KP%2B8kiV7HEkg5XpFHHF4ChAGiXK%2BWcFgMEQKFQuzoOJyEoNAAPoeI9UMYA2i4JgFCURo%2BDobZiBfCBonvaIwgac5OEXLDmGIc4AHlom0Tpl2HUhQLYQRiIYWhcI4LRSCwaIvGANwxF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YW29v9QGMjpFRz8SwuOajhZmFqW7dJywjJpGcJIIAA%3D%3D%3D))
```c++
template <typename T>
struct ptr {
template <typename U>
friend ptr<U> make_item(auto&&... args) noexcept
requires(__is_constructible(U, decltype(args)...));
};
template <typename U> ptr<char> target;
clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:4404: llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::VarDecl*, 4>> clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*): Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' failed.
|
…ion (#114749) We need to compare constraint expressions when instantiating a friend declaration that is lexically defined within a class template. Since the evaluation is deferred, the expression might refer to untransformed function parameters such that the substitution needs the mapping of instantiation. These mappings are maintained by the function declaration instantiation, so we need to establish a "transparent" LocalInstantiationScope before substituting into the constraint. No release note as this fixes a regression in 19. Fixes #114685
…ion (llvm#114749) We need to compare constraint expressions when instantiating a friend declaration that is lexically defined within a class template. Since the evaluation is deferred, the expression might refer to untransformed function parameters such that the substitution needs the mapping of instantiation. These mappings are maintained by the function declaration instantiation, so we need to establish a "transparent" LocalInstantiationScope before substituting into the constraint. No release note as this fixes a regression in 19. Fixes llvm#114685
The following code (which is simplify to contain what is needed for the error) compiles fine on Clang 18, but crashes Clang 19. (godbolt)
With an assert compiler, it outputs this.
It seems to be related to
decltype(args)...
in therequires
of atemplate friend
that has atemplate
d function, as removing themake_item
is the global scope, or replacingdecltype(args)...
withA...
makes the code compile.The text was updated successfully, but these errors were encountered: