pt.c (tsubst_copy_and_build): Don't complain about unqualified lookup failing if...
authorJason Merrill <jason@redhat.com>
Wed, 13 Apr 2011 14:34:05 +0000 (10:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 13 Apr 2011 14:34:05 +0000 (10:34 -0400)
* 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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/sfinae13.C [new file with mode: 0644]

index 63dbaf04b20565b9d845c7aa4dadec465c47c085..f144d5004cfbf8884d08366186506cfa1f218d80 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-13  Jason Merrill  <jason@redhat.com>
+
+       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  <froydnj@codesourcery.com>
 
        * cp-lang.c (cp_init_ts): Call cp_common_init_ts.  Move
index 208ff2ba433c047ab7d66b81ff0a695f0070ec75..3356e7555f5bd7ec476c0d7103e18e85aa39b333 100644 (file)
@@ -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);
index 5904635de2cb4d0786885bbd6c198ccb3041ea63..e740808ddcba7c8e2b6e837f5416e2c9f5f46b33 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-13  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/sfinae13.C: New.
+
 2011-04-13  Uros Bizjak  <ubizjak@gmail.com>
 
        * 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 (file)
index 0000000..465df2d
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/48581
+// { dg-options -std=c++0x }
+
+template<class T>
+T&& create();
+
+template<class T,
+  class = decltype(foo(create<T>()))
+>
+auto f(int) -> char;
+
+template<class>
+auto f(...) -> char (&)[2];
+
+struct S {};
+void foo(S);
+
+static_assert(sizeof(f<S>(0)) == 1, "Error"); // (#)
+
+int main() {}