/* Construct a top-level context for DECL. */
norm_info (tree in_decl, bool diag)
- : subst_info (tf_warning_or_error, in_decl),
+ : subst_info (tf_warning_or_error|tf_partial, in_decl),
generate_diagnostics (diag)
{
if (in_decl)
case LAMBDA_EXPR:
{
+ /* TREE_STATIC on LAMBDA_EXPR_EXTRA_ARGS means a full set of
+ arguments, so we can just look there; they will replace
+ any template parms in the rest of the LAMBDA_EXPR. */
+ if (tree args = LAMBDA_EXPR_EXTRA_ARGS (t))
+ {
+ WALK_SUBTREE (args);
+ /* Without TREE_STATIC the args are just outer levels, so we'd
+ still need to look through the lambda for just inner
+ parameters. Hopefully that's not necessary. */
+ gcc_checking_assert (TREE_STATIC (args));
+ return 0;
+ }
/* Look in the parms and body. */
tree fn = lambda_function (t);
WALK_SUBTREE (TREE_TYPE (fn));
--- /dev/null
+// PR c++/118698
+// { dg-do compile { target c++20 } }
+
+template <typename T> struct foo {};
+template <typename T> struct bar {};
+
+template <class T> T&& declval ();
+
+template <typename T, typename U>
+concept callable = requires { declval<T>()(declval<U>()); };
+
+template <typename T, template <typename...> typename U>
+concept is_specialization_of = callable<decltype([]<typename... Args>( U<Args...> const& ) { }),T>;
+
+static_assert( is_specialization_of<foo<int>,foo> == true );
+static_assert( is_specialization_of<foo<int>,bar> == false );
+
+template <typename T> concept is_foo = is_specialization_of<T,foo>;
+
+static_assert( is_foo<foo<int>> );
+static_assert( is_foo<bar<int>> == false );