aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/consteval-virtual1.C
blob: 5cdb75ab89af1c147a79f9a84afd614e9b7e13d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// { dg-do compile { target c++20 } }

struct S {
  virtual int foo () { return 42; }		// { dg-message "overridden function is 'virtual int S::foo\\\(\\\)'" }
  consteval virtual int bar () { return 43; }	// { dg-message "overridden function is 'virtual consteval int S::bar\\\(\\\)'" }
};
struct T : public S {
  int bar () { return 44; }	// { dg-error "non-'consteval' function 'virtual int T::bar\\\(\\\)' overriding 'consteval' function" }
};
struct U : public S {
  consteval virtual int foo () { return 45; }	// { dg-error "'consteval' function 'virtual consteval int U::foo\\\(\\\)' overriding non-'consteval' function" }
};