/* Avoid error about taking the address of a constructor. */
function = TREE_OPERAND (function, 0);
- /* When KOENIG_P, we don't want to mark_used the callee before
- augmenting the overload set via ADL, so during this initial
- substitution we disable mark_used by setting tf_conv (68942). */
- function = tsubst_copy_and_build (function, args,
- complain | (koenig_p * tf_conv),
+ tsubst_flags_t subcomplain = complain;
+ if (koenig_p && TREE_CODE (function) == FUNCTION_DECL)
+ /* When KOENIG_P, we don't want to mark_used the callee before
+ augmenting the overload set via ADL, so during this initial
+ substitution we disable mark_used by setting tf_conv (68942). */
+ subcomplain |= tf_conv;
+ function = tsubst_copy_and_build (function, args, subcomplain,
in_decl,
!qualified_p,
integral_constant_expression_p);
--- /dev/null
+// PR c++/100344
+// { dg-do compile { target c++11 } }
+
+template <class> constexpr int find_index() { return 1; }
+
+template <int, class T> void foo(T);
+
+template <class T> void get(T v) {
+ foo<find_index<T>()>(v);
+}
+
+int main() {
+ get(0);
+}
--- /dev/null
+// PR c++/68942
+// { dg-do compile { target c++11 } }
+// A template-id analogue of koenig12.C.
+
+template <int> void foo(...) = delete;
+
+template <class T> void lookup(T t) { foo<0>(t); }
+
+namespace N {
+ struct A { };
+ template <int> int foo(A);
+}
+
+int main() {
+ lookup(N::A{});
+}