Affected subclause: [dcl.typedef]
Change:
Unnamed classes with a typedef name for linkage purposes
can contain only C-compatible constructs
. Rationale:
Necessary for implementability
. Effect on original feature:
Valid C++ 2017 code may be ill-formed in this International Standard
.
typedef struct {
void f() {}
} S;
Affected subclause: [dcl.fct.default]
Change:
A function cannot have different default arguments
in different translation units
. Rationale:
Required for modules support
. Effect on original feature:
Valid C++ 2017 code may be ill-formed in this International Standard,
with no diagnostic required
.
int f(int a = 42);
int g() { return f(); }
int f(int a = 76) { return a; }
int g();
int main() { return g(); }
Affected subclause: [dcl.init.aggr]
Change:
A class that has user-declared constructors is never an aggregate
. Rationale:
Remove potentially error-prone aggregate initialization
which may apply notwithstanding the declared constructors of a class
. Effect on original feature:
Valid C++ 2017 code that aggregate-initializes
a type with a user-declared constructor
may be ill-formed or have different semantics
in this International Standard
.
struct A {
A() = delete;
};
struct B {
B() = default;
int i = 0;
};
struct C {
C(C&&) = default;
int a, b;
};
A a{};
B b = {1};
auto* c = new C{2, 3};
struct Y;
struct X {
operator Y();
};
struct Y {
Y(const Y&) = default;
X x;
};
Y y{X{}};