diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/koenig6.C | 29 |
4 files changed, 44 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 57ae757..3068674 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-01-15 Jason Merrill <jason@redhat.com> + + PR c++/38850 + * pt.c (tsubst_copy_and_build): Tell finish_call_expr to + accept hidden friends. + 2009-01-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C++/29388 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0618fe2..0378d39 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11400,9 +11400,12 @@ tsubst_copy_and_build (tree t, /*fn_p=*/NULL, complain)); } + /* Pass true for koenig_p so that build_new_function_call will + allow hidden friends found by arg-dependent lookup at template + parsing time. */ return finish_call_expr (function, call_args, /*disallow_virtual=*/qualified_p, - koenig_p, + /*koenig_p*/true, complain); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e46d1f..0a4383f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-15 Jason Merrill <jason@redhat.com> + + PR c++/38850 + * g++.dg/template/koenig6.C: New test. + 2009-01-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C++/29388 diff --git a/gcc/testsuite/g++.dg/template/koenig6.C b/gcc/testsuite/g++.dg/template/koenig6.C new file mode 100644 index 0000000..8f93a65 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/koenig6.C @@ -0,0 +1,29 @@ +// PR c++/38850 + +template <typename VType> +class Vector2 { + private: + VType c_[2]; + public: + typedef Vector2<VType> Self; + + Vector2(const VType x, const VType y) { + c_[0] = x; + c_[1] = y; + } + + friend inline Self Max(const Self &v1, const Self &v2) { + return Self(v1.c_[0], v1.c_[1]); + } +}; + +template <class T> +Vector2<float> foo(T x) { + Vector2<float> y(0,0); + return Max(y, y); +} + +int main() { + foo(3); + return 0; +} |