@@ -5068,6 +5068,10 @@ mark_used (tree decl, tsubst_flags_t complain)
/* Set TREE_USED for the benefit of -Wunused. */
TREE_USED (decl) = 1;
+
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ return true;
+
if (DECL_CLONED_FUNCTION_P (decl))
TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
new file mode 100644
@@ -0,0 +1,34 @@
+// PR c++/69283
+// { dg-do compile { target c++14 } }
+
+namespace Ape {
+ struct Type {};
+
+ template <typename T>
+ auto f1(T const& v){
+ return true;
+ }
+
+ template <typename T>
+ auto f2(T const& v){
+ return f2(v); // { dg-error "auto" }
+ }
+}
+
+namespace Baboon {
+ template <typename T>
+ bool f3(T const& v){
+ return f1(v);
+ }
+
+ template <typename T>
+ bool f4(T const& v){
+ f2(v);
+ }
+}
+
+int main(){
+ Ape::Type x;
+ Baboon::f3(x);
+ Baboon::f4(x);
+}
new file mode 100644
@@ -0,0 +1,21 @@
+// PR c++/67835
+// { dg-do compile { target c++14 } }
+
+template<class Tag, class T>
+auto g(Tag tag, T x) {
+ return f(tag, x);
+}
+
+namespace abc {
+struct tag {};
+
+struct A {};
+
+template<class T>
+auto f(tag, T x) { return x; }
+}
+
+int main() {
+ g(abc::tag(), abc::A());
+ return 0;
+}