Files
clang-p2996/clang/test/CXX/dcl.decl/dcl.init/p7.cpp
Eric Fiselier 283d8d45db [Sema] Don't perform aggregate initialization for types with explicit constructors
Summary:
The C++17 rules for aggregate initialization changed to disallow types with explicit constructors [dcl.init.aggr]p1. This patch implements that new rule.


Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25654

llvm-svn: 288565
2016-12-03 01:26:47 +00:00

17 lines
381 B
C++

// RUN: %clang_cc1 -std=c++11 -verify %s
struct NotAggregateBase {};
struct A : NotAggregateBase {
private:
A() = default; // expected-note {{here}}
};
A a = {}; // expected-error {{calling a private constructor}}
struct B : NotAggregateBase {
explicit B() = default; // expected-note {{here}}
};
B b = {}; // expected-error {{chosen constructor is explicit}}
B b2{};
B b3;