view gcc/testsuite/g++.dg/cpp0x/decltype-pr81506.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

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