From: Martin Sebor Date: Thu, 28 Mar 2019 21:20:18 +0000 (+0000) Subject: PR c++/81506 - Invalid declaration with decltype accepted X-Git-Tag: upstream/12.2.0~25440 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4eb8255191896120db49604760daa1234abd86b9;p=platform%2Fupstream%2Fgcc.git PR c++/81506 - Invalid declaration with decltype accepted testsuite/ChangeLog: * g++.dg/cpp0x/decltype-pr81506.C: New test. From-SVN: r270006 --- 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 + + PR c++/81506 + * g++.dg/cpp0x/decltype-pr81506.C: New test. + 2019-03-28 Marek Polacek 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 +struct A +{ + A () { + decltype (this); // { dg-error "declaration does not declare anything" } + } +}; + +A<0> a; + +template +struct B +{ + B () { + __typeof__ (this); // { dg-error "declaration does not declare anything" } + } +}; + +B b; +