From: Jason Merrill Date: Fri, 1 Jul 2011 20:24:08 +0000 (-0400) Subject: re PR c++/48883 (?: ternary operator fails in certain contexts - link error) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a771bf1cf6a6d6f785f5b6f714e9d732ccfcc757;p=gcc.git 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 --- 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 */ +}