diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2015-12-15 10:18:13 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-12-15 10:18:13 +0000 |
commit | 293b1f44fa2d5617e3c6ccac1c6d2874a02d483a (patch) | |
tree | be999f63796ea0203331654b574baf94523dd807 /gcc | |
parent | 2764999bbddb1b480c52750b5d6cd0ef037dda68 (diff) | |
download | gcc-293b1f44fa2d5617e3c6ccac1c6d2874a02d483a.zip gcc-293b1f44fa2d5617e3c6ccac1c6d2874a02d483a.tar.gz gcc-293b1f44fa2d5617e3c6ccac1c6d2874a02d483a.tar.bz2 |
re PR c++/63506 (GCC deduces wrong return type of operator*() inside template functions)
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr63506-1.C | 24 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr63506-2.C | 27 |
3 files changed, 57 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 790d9c1..4d749f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..dbdcdfb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr63506-1.C @@ -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 index 0000000..b6b74e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr63506-2.C @@ -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); +} |