PR c++/81506 - Invalid declaration with decltype accepted

testsuite/ChangeLog:
	* g++.dg/cpp0x/decltype-pr81506.C: New test.

From-SVN: r270006
This commit is contained in:
Martin Sebor 2019-03-28 21:20:18 +00:00 committed by Martin Sebor
parent c526171d73
commit 4eb8255191
2 changed files with 33 additions and 0 deletions

View File

@ -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.

View File

@ -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;