re PR c++/48883 (?: ternary operator fails in certain contexts - link error)
authorJason Merrill <jason@redhat.com>
Fri, 1 Jul 2011 20:24:08 +0000 (16:24 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 1 Jul 2011 20:24:08 +0000 (16:24 -0400)
PR c++/48883
PR c++/49609
* pt.c (resolve_nondeduced_context): Call mark_used.

From-SVN: r175764

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/explicit-args4.C [new file with mode: 0644]

index 842d049b2a463cb4303984b8b8aeb809f1c459a1..ac7edddfe28d1bdb1739044c9db59a7bc5a7e486 100644 (file)
@@ -1,5 +1,9 @@
 2011-07-01  Jason Merrill  <jason@redhat.com>
 
+       PR c++/48883
+       PR c++/49609
+       * pt.c (resolve_nondeduced_context): Call mark_used.
+
        PR c++/49085
        * semantics.c (finish_offsetof): Complain about incomplete type.
 
index 4903044ff70d280a07c9472503b104e2c8348dac..947e19e6283a9aab083f642fc9cb9fc11369bffb 100644 (file)
@@ -14679,6 +14679,7 @@ resolve_nondeduced_context (tree orig_expr)
        }
       if (good == 1)
        {
+         mark_used (goodfn);
          expr = goodfn;
          if (baselink)
            expr = build_baselink (BASELINK_BINFO (baselink),
index 8f2053a84fd2546a36b416c722efcd8ae3014e8d..903e0fb22f1409d2eb7a1234192ce78a0e840b10 100644 (file)
@@ -1,5 +1,8 @@
 2011-07-01  Jason Merrill  <jason@redhat.com>
 
+       PR c++/48883
+       * g++.dg/template/explicit-args4.C: New.
+
        PR c++/49085
        * g++.dg/template/offsetof2.C: New.
 
diff --git a/gcc/testsuite/g++.dg/template/explicit-args4.C b/gcc/testsuite/g++.dg/template/explicit-args4.C
new file mode 100644 (file)
index 0000000..c64a085
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/48883
+// { dg-do link }
+
+template<typename T>
+T myMax(T a, T b) {
+   if(a < b) return a;
+   return b;
+}
+
+int main() {
+   bool even = true;
+   int (*fp)(int, int);
+   fp = even ? myMax<int> : myMax<int>;   /* yields link error */
+}