Where possible, don't try to ask whether a template argument is
authorRichard Smith <richard@metafoo.co.uk>
Thu, 16 Jul 2020 02:38:46 +0000 (19:38 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Fri, 18 Dec 2020 07:23:05 +0000 (23:23 -0800)
commit71886c56f336667969be4cac0b6a17a3f75b7555
treeb7d9f44a2ebdd56775f743c3863e14f80d3dd494
parent638867afd4bce4a2c56dea041299428af3727d61
Where possible, don't try to ask whether a template argument is
dependent until it's been converted to match its parameter.

The type of a non-type template parameter can in general affect whether
the template argument is dependent.

Note that this is not always possible. For template arguments that name
static local variables in templates, the type of the template parameter
affects whether the argument is dependent, so the query is imprecise
until we know the parameter type. For example, in:

template<typename T> void f() {
  static const int n = 5;
  typename T::template X<n> x;
}

... we don't know whether 'n' is dependent until we know whether the
corresponding template parameter is of type 'int' or 'const int&'.
clang/include/clang/AST/Type.h
clang/lib/AST/Type.cpp
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/SemaTemplate/instantiate-static-local.cpp [new file with mode: 0644]