File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1347,6 +1347,33 @@ void test()
1347
1347
specialized than a function without.
1348
1348
)
1349
1349
1350
+ $(P A static member function can be overloaded with a member
1351
+ function. The struct, class
1352
+ or union of the static member function is inferred from the
1353
+ type of the `this` argument.)
1354
+
1355
+ ---
1356
+ struct S {
1357
+ void eggs(int);
1358
+ static void eggs(long);
1359
+ }
1360
+ S s;
1361
+ s.eggs(0); // calls void eggs(int);
1362
+ S.eggs(0); // error: need `this`
1363
+ s.eggs(0L); // calls static void eggs(long);
1364
+ S.eggs(0L); // calls static void eggs(long);
1365
+
1366
+ struct T {
1367
+ void bacon(int);
1368
+ static void bacon(int);
1369
+ }
1370
+ T t;
1371
+ t.bacon(0); // error: ambiguous
1372
+ T.bacon(0); // error: ambiguous
1373
+ ---
1374
+
1375
+ $(RATIONALE A static member function that doesn't need
1376
+ the `this` parameter does not need to pass it.)
1350
1377
1351
1378
$(H3 $(LNAME2 overload-sets, Overload Sets))
1352
1379
You can’t perform that action at this time.
0 commit comments