Clang Project

clang_source_code/test/SemaCXX/cxx11-default-member-initializers.cpp
1// RUN: %clang_cc1 -std=c++11 -verify %s -pedantic
2
3namespace PR31692 {
4  struct A {
5    struct X { int n = 0; } x;
6    // Trigger construction of X() from a SFINAE context. This must not mark
7    // any part of X as invalid.
8    static_assert(!__is_constructible(X), "");
9    // Check that X::n is not marked invalid.
10    double &r = x.n; // expected-error {{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}}
11  };
12  // A::X can now be default-constructed.
13  static_assert(__is_constructible(A::X), "");
14}
15