aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/constexpr-default-init-value-crash.cpp
blob: 766ca0fee00de33e21cb0de34287789afe1d898f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fno-recovery-ast
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fexperimental-new-constant-interpreter
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify -fno-recovery-ast -fexperimental-new-constant-interpreter


namespace NoCrash {
struct ForwardDecl; // expected-note {{forward declaration of}}
struct Foo {        // expected-note 2{{candidate constructor}}
  ForwardDecl f;    // expected-error {{field has incomplete type}}
};

constexpr Foo getFoo() {
  Foo e = 123; // expected-error {{no viable conversion from 'int' to 'Foo'}}
  return e;
}
}