Any of these template argument kinds can be represented with an expression, so
accept them in this constructor.
Patch by Balaji Iyer!
rdar://
41459965
Differential revision: https://reviews.llvm.org/D49766
llvm-svn: 338338
TemplateArgumentLoc(const TemplateArgument &Argument, Expr *E)
: Argument(Argument), LocInfo(E) {
- assert(Argument.getKind() == TemplateArgument::Expression);
+
+ // Permit any kind of template argument that can be represented with an
+ // expression
+ assert(Argument.getKind() == TemplateArgument::NullPtr ||
+ Argument.getKind() == TemplateArgument::Integral ||
+ Argument.getKind() == TemplateArgument::Declaration ||
+ Argument.getKind() == TemplateArgument::Expression);
}
TemplateArgumentLoc(const TemplateArgument &Argument,
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+// expected-no-diagnostics
+template <typename a, int* = nullptr>
+struct e {
+ e(a) {}
+};
+e c(0);