[diff.cpp17.dcl.dcl]

# Annex C (informative) Compatibility [[diff]](./#diff)

## C.3 C++ and ISO C++ 2017 [[diff.cpp17]](diff.cpp17#dcl.dcl)

### C.3.5 [[dcl]](dcl "9 Declarations"): declarations [diff.cpp17.dcl.dcl]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1024)

**Affected subclause:** [[dcl.typedef]](dcl.typedef)  


**Change:** Unnamed classes with a typedef name for linkage purposes
can contain only C-compatible constructs[.](#1.sentence-1)

  


**Rationale:** Necessary for implementability[.](#1.sentence-2)

  


**Effect on original feature:** Valid C++ 2017 code may be ill-formed in this revision of C++[.](#1.sentence-3)

[*Example [1](#example-1)*: typedef struct {void f() {} // ill-formed; previously well-formed} S; â *end example*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1040)

**Affected subclause:** [[dcl.fct.default]](dcl.fct.default)  


**Change:** A function cannot have different default arguments
in different translation units[.](#2.sentence-1)

  


**Rationale:** Required for modules support[.](#2.sentence-2)

  


**Effect on original feature:** Valid C++ 2017 code may be ill-formed in this revision of C++,
with no diagnostic required[.](#2.sentence-3)

[*Example [2](#example-2)*: // Translation unit 1int f(int a = 42);int g() { return f(); }// Translation unit 2int f(int a = 76) { return a; } // ill-formed, no diagnostic required; previously well-formedint g();int main() { return g(); } // used to return 42 â *end example*]

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1062)

**Affected subclause:** [[dcl.init.aggr]](dcl.init.aggr)  


**Change:** A class that has user-declared constructors is never an aggregate[.](#3.sentence-1)

  


**Rationale:** Remove potentially error-prone aggregate initialization
which may apply notwithstanding the declared constructors of a class[.](#3.sentence-2)

  


**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 revision of C++[.](#3.sentence-3)

[*Example [3](#example-3)*: struct A { // not an aggregate; previously an aggregate A() = delete;};

struct B { // not an aggregate; previously an aggregate B() = default; int i = 0;};

struct C { // not an aggregate; previously an aggregate C(C&&) = default; int a, b;};

A a{}; // ill-formed; previously well-formed B b = {1}; // ill-formed; previously well-formedauto* c = new C{2, 3}; // ill-formed; previously well-formedstruct Y;

struct X {operator Y();};

struct Y { // not an aggregate; previously an aggregate Y(const Y&) = default;
 X x;};

Y y{X{}}; // copy constructor call; previously aggregate-initialization â *end example*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1108)

**Affected subclause:** [[dcl.init.list]](dcl.init.list)  


**Change:** Boolean conversion from a pointer or pointer-to-member type
is now a narrowing conversion[.](#4.sentence-1)

  


**Rationale:** Catches bugs[.](#4.sentence-2)

  


**Effect on original feature:** Valid C++ 2017 code may fail to compile
in this revision of C++[.](#4.sentence-3)

[*Example [4](#example-4)*: bool y[] = { "bc" }; // ill-formed; previously well-formed â *end example*]
