Skip to content

Commit 07f02ff

Browse files
committed
[over.ics.list] expand example 5, fix inconsistent spacing
1 parent 3a2586c commit 07f02ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

source/overloading.tex

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,19 +2419,21 @@
24192419
\begin{codeblock}
24202420
void f(std::initializer_list<int>);
24212421
f( {} ); // OK, \tcode{f(initializer_list<int>)} identity conversion
2422-
f( {1,2,3} ); // OK, \tcode{f(initializer_list<int>)} identity conversion
2423-
f( {'a','b'} ); // OK, \tcode{f(initializer_list<int>)} integral promotion
2422+
f( {1, 2, 3} ); // OK, \tcode{f(initializer_list<int>)} identity conversion
2423+
f( {'a', 'b'} ); // OK, \tcode{f(initializer_list<int>)} integral promotion
24242424
f( {1.0} ); // error: narrowing
24252425

24262426
struct A {
24272427
A(std::initializer_list<double>); // \#1
24282428
A(std::initializer_list<complex<double>>); // \#2
2429-
A(std::initializer_list<std::string>); // \#3
2429+
A(std::initializer_list<A>); // \#3
2430+
A(std::initializer_list<std::string>); // \#4
24302431
};
2431-
A a{ 1.0,2.0 }; // OK, uses \#1
2432+
A a{ 1.0, 2.0 }; // OK, uses \#1, not \#2
2433+
A b{ a }; // OK, uses \#3, not the implicitly-defined copy constructor
24322434

24332435
void g(A);
2434-
g({ "foo", "bar" }); // OK, uses \#3
2436+
g({ "foo", "bar" }); // OK, uses \#4
24352437

24362438
typedef int IA[3];
24372439
void h(const IA&);

0 commit comments

Comments
 (0)