From a771bf1cf6a6d6f785f5b6f714e9d732ccfcc757 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 1 Jul 2011 16:24:08 -0400 Subject: [PATCH] re PR c++/48883 (?: ternary operator fails in certain contexts - link error) PR c++/48883 PR c++/49609 * pt.c (resolve_nondeduced_context): Call mark_used. From-SVN: r175764 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 1 + gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/template/explicit-args4.C | 14 ++++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/explicit-args4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 842d049b2a4..ac7edddfe28 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-07-01 Jason Merrill + 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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4903044ff70..947e19e6283 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8f2053a84fd..903e0fb22f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-07-01 Jason Merrill + 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 index 00000000000..c64a085edb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-args4.C @@ -0,0 +1,14 @@ +// PR c++/48883 +// { dg-do link } + +template +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 : myMax; /* yields link error */ +} -- 2.30.2