diff options
author | Martin Sebor <msebor@redhat.com> | 2019-03-28 21:20:18 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-03-28 15:20:18 -0600 |
commit | 4eb8255191896120db49604760daa1234abd86b9 (patch) | |
tree | ae2fd47d8d11f6bda15e13f56eb189ca72b93a82 | |
parent | c526171d734653ebde26fc8a29191247add7bf3e (diff) | |
download | gcc-4eb8255191896120db49604760daa1234abd86b9.zip gcc-4eb8255191896120db49604760daa1234abd86b9.tar.gz gcc-4eb8255191896120db49604760daa1234abd86b9.tar.bz2 |
PR c++/81506 - Invalid declaration with decltype accepted
testsuite/ChangeLog:
* g++.dg/cpp0x/decltype-pr81506.C: New test.
From-SVN: r270006
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype-pr81506.C | 28 |
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a496ec..e0832a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-28 Martin Sebor <msebor@redhat.com> + + PR c++/81506 + * g++.dg/cpp0x/decltype-pr81506.C: New test. + 2019-03-28 Marek Polacek <polacek@redhat.com> PR c++/89612 - ICE with member friend template with noexcept. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-pr81506.C b/gcc/testsuite/g++.dg/cpp0x/decltype-pr81506.C new file mode 100644 index 0000000..ecf762e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-pr81506.C @@ -0,0 +1,28 @@ +// PR c++/81506 - Invalid declaration with decltype accepted +// { dg-do compile } +// + +#if __cplusplus < 201103L +# define decltype __typeof__ +#endif + +template <int> +struct A +{ + A () { + decltype (this); // { dg-error "declaration does not declare anything" } + } +}; + +A<0> a; + +template <class> +struct B +{ + B () { + __typeof__ (this); // { dg-error "declaration does not declare anything" } + } +}; + +B<int> b; + |