From ba9c349ec817c21ef7a72455a240cdc8f2c4926d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 13 Apr 2011 10:34:05 -0400 Subject: [PATCH] pt.c (tsubst_copy_and_build): Don't complain about unqualified lookup failing if we're still in a template. * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Don't complain about unqualified lookup failing if we're still in a template. From-SVN: r172372 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/sfinae13.C | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae13.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 63dbaf04b20..f144d5004cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-13 Jason Merrill + + PR c++/48581 + * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Don't complain about + unqualified lookup failing if we're still in a template. + 2011-04-12 Nathan Froyd * cp-lang.c (cp_init_ts): Call cp_common_init_ts. Move diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 208ff2ba433..3356e7555f5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12938,7 +12938,8 @@ tsubst_copy_and_build (tree t, && !any_type_dependent_arguments_p (call_args)) function = perform_koenig_lookup (function, call_args, false); - if (TREE_CODE (function) == IDENTIFIER_NODE) + if (TREE_CODE (function) == IDENTIFIER_NODE + && !processing_template_decl) { unqualified_name_lookup_error (function); release_tree_vector (call_args); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5904635de2c..e740808ddcb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-13 Jason Merrill + + * g++.dg/cpp0x/sfinae13.C: New. + 2011-04-13 Uros Bizjak * gcc.target/i386/sse2-init-v2di-2.c: Update scan pattern. diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae13.C b/gcc/testsuite/g++.dg/cpp0x/sfinae13.C new file mode 100644 index 00000000000..465df2d8b8c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae13.C @@ -0,0 +1,20 @@ +// PR c++/48581 +// { dg-options -std=c++0x } + +template +T&& create(); + +template())) +> +auto f(int) -> char; + +template +auto f(...) -> char (&)[2]; + +struct S {}; +void foo(S); + +static_assert(sizeof(f(0)) == 1, "Error"); // (#) + +int main() {} -- 2.30.2