re PR c++/63506 (GCC deduces wrong return type of operator*() inside template functions)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 15 Dec 2015 10:18:13 +0000 (10:18 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 15 Dec 2015 10:18:13 +0000 (10:18 +0000)
2015-12-15  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/63506
* g++.dg/cpp0x/pr63506-1.C: New.
* g++.dg/cpp0x/pr63506-2.C: Likewise.

From-SVN: r231646

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr63506-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr63506-2.C [new file with mode: 0644]

index 790d9c14df92f424622095728ee90a727cb0def7..4d749f1d1f26cfd44cd35d0bbadd3a6153780688 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/63506
+       * g++.dg/cpp0x/pr63506-1.C: New.
+       * g++.dg/cpp0x/pr63506-2.C: Likewise.
+
 2015-12-15  Olivier Hainque  <hainque@adacore.com>
 
        * gcc.target/visium/block_move.c: Skip for -mcpu=gr5.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr63506-1.C b/gcc/testsuite/g++.dg/cpp0x/pr63506-1.C
new file mode 100644 (file)
index 0000000..dbdcdfb
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-do compile { target c++11 } }
+
+struct proxy {};
+
+struct iterator
+{
+  proxy operator*() { return proxy(); }
+};
+
+//#define DEACTIVATE
+
+#ifndef DEACTIVATE
+template<typename T = int>
+#endif
+void foo(iterator it)
+{
+  auto&& x = *it;
+}
+
+int main() 
+{
+  iterator it;
+  foo(it);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr63506-2.C b/gcc/testsuite/g++.dg/cpp0x/pr63506-2.C
new file mode 100644 (file)
index 0000000..b6b74e5
--- /dev/null
@@ -0,0 +1,27 @@
+// { dg-do compile { target c++11 } }
+
+struct proxy {};
+
+struct iterator
+{
+  proxy operator*() { return proxy(); }
+
+  proxy operator[](int i) { return proxy(); }
+};
+
+//#define DEACTIVATE
+
+#ifndef DEACTIVATE
+template<typename T = int>
+#endif
+void foo(iterator it)
+{
+  auto&& x = *it;
+  auto&& y = it[1];
+}
+
+int main()
+{
+  iterator it;
+  foo(it);
+}