view clang/test/Sema/invalid-member.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 2e18cbf3894f
children
line wrap: on
line source

// RUN: %clang_cc1 -verify -fsyntax-only -fno-recovery-ast %s
// RUN: %clang_cc1 -verify -fsyntax-only -frecovery-ast %s

void foo(); // expected-note 2{{requires 0 arguments}}
class X {
  decltype(foo(42)) invalid; // expected-error {{no matching function}}
};
// Should be able to evaluate sizeof without crashing.
static_assert(sizeof(X) == 1, "No valid members");

class Y {
  typeof(foo(42)) invalid; // expected-error {{no matching function}}
};
// Should be able to evaluate sizeof without crashing.
static_assert(sizeof(Y) == 1, "No valid members");

class Z {
  int array[sizeof(invalid())]; // expected-error {{use of undeclared identifier}}
};
// Should be able to evaluate sizeof without crashing.
static_assert(sizeof(Z) == 1, "No valid members");

constexpr int N = undef; // expected-error {{use of undeclared identifier}}
template<int a>
class ABC {};
class T {
  ABC<N> abc;
};
static_assert(sizeof(T) == 1, "No valid members");