tmp/tmpo_8ufyi2/{from.md → to.md}
RENAMED
|
@@ -15,12 +15,12 @@ specified name is so declared; specifying an enumeration name in a
|
|
| 15 |
*using-declaration* does not declare its enumerators in the
|
| 16 |
*using-declaration*’s declarative region. If a *using-declaration* names
|
| 17 |
a constructor ([[class.qual]]), it implicitly declares a set of
|
| 18 |
constructors in the class in which the *using-declaration* appears (
|
| 19 |
[[class.inhctor]]); otherwise the name specified in a
|
| 20 |
-
*using-declaration* is a synonym for
|
| 21 |
-
|
| 22 |
|
| 23 |
Every *using-declaration* is a *declaration* and a *member-declaration*
|
| 24 |
and so can be used in a class definition.
|
| 25 |
|
| 26 |
``` cpp
|
|
@@ -154,14 +154,16 @@ struct X : B {
|
|
| 154 |
using B::i;
|
| 155 |
using B::i; // error: double member declaration
|
| 156 |
};
|
| 157 |
```
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
*using-declaration*
|
| 162 |
-
|
|
|
|
|
|
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
namespace A {
|
| 166 |
void f(int);
|
| 167 |
}
|
|
@@ -223,17 +225,20 @@ void func() {
|
|
| 223 |
struct x x1; // x1 has class type B::x
|
| 224 |
}
|
| 225 |
```
|
| 226 |
|
| 227 |
If a function declaration in namespace scope or block scope has the same
|
| 228 |
-
name and the same parameter
|
| 229 |
-
*using-declaration*, and the declarations do not declare
|
| 230 |
-
function, the program is ill-formed.
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
namespace B {
|
| 238 |
void f(int);
|
| 239 |
void f(double);
|
|
@@ -256,11 +261,11 @@ void h() {
|
|
| 256 |
When a *using-declaration* brings names from a base class into a derived
|
| 257 |
class scope, member functions and member function templates in the
|
| 258 |
derived class override and/or hide member functions and member function
|
| 259 |
templates with the same name, parameter-type-list ([[dcl.fct]]),
|
| 260 |
cv-qualification, and *ref-qualifier* (if any) in a base class (rather
|
| 261 |
-
than conflicting). For *using-
|
| 262 |
see [[class.inhctor]].
|
| 263 |
|
| 264 |
``` cpp
|
| 265 |
struct B {
|
| 266 |
virtual void f(int);
|
|
|
|
| 15 |
*using-declaration* does not declare its enumerators in the
|
| 16 |
*using-declaration*’s declarative region. If a *using-declaration* names
|
| 17 |
a constructor ([[class.qual]]), it implicitly declares a set of
|
| 18 |
constructors in the class in which the *using-declaration* appears (
|
| 19 |
[[class.inhctor]]); otherwise the name specified in a
|
| 20 |
+
*using-declaration* is a synonym for a set of declarations in another
|
| 21 |
+
namespace or class.
|
| 22 |
|
| 23 |
Every *using-declaration* is a *declaration* and a *member-declaration*
|
| 24 |
and so can be used in a class definition.
|
| 25 |
|
| 26 |
``` cpp
|
|
|
|
| 154 |
using B::i;
|
| 155 |
using B::i; // error: double member declaration
|
| 156 |
};
|
| 157 |
```
|
| 158 |
|
| 159 |
+
Members added to the namespace after the *using-declaration* are not
|
| 160 |
+
considered when a use of the name is made. Thus, additional overloads
|
| 161 |
+
added after the *using-declaration* are ignored, but default function
|
| 162 |
+
arguments ([[dcl.fct.default]]), default template arguments (
|
| 163 |
+
[[temp.param]]), and template specializations ([[temp.class.spec]],
|
| 164 |
+
[[temp.expl.spec]]) are considered.
|
| 165 |
|
| 166 |
``` cpp
|
| 167 |
namespace A {
|
| 168 |
void f(int);
|
| 169 |
}
|
|
|
|
| 225 |
struct x x1; // x1 has class type B::x
|
| 226 |
}
|
| 227 |
```
|
| 228 |
|
| 229 |
If a function declaration in namespace scope or block scope has the same
|
| 230 |
+
name and the same parameter-type-list ([[dcl.fct]]) as a function
|
| 231 |
+
introduced by a *using-declaration*, and the declarations do not declare
|
| 232 |
+
the same function, the program is ill-formed. If a function template
|
| 233 |
+
declaration in namespace scope has the same name, parameter-type-list,
|
| 234 |
+
return type, and template parameter list as a function template
|
| 235 |
+
introduced by a *using-declaration*, the program is ill-formed. Two
|
| 236 |
+
*using-declaration*s may introduce functions with the same name and the
|
| 237 |
+
same parameter-type-list. If, for a call to an unqualified function
|
| 238 |
+
name, function overload resolution selects the functions introduced by
|
| 239 |
+
such *using-declaration*s, the function call is ill-formed.
|
| 240 |
|
| 241 |
``` cpp
|
| 242 |
namespace B {
|
| 243 |
void f(int);
|
| 244 |
void f(double);
|
|
|
|
| 261 |
When a *using-declaration* brings names from a base class into a derived
|
| 262 |
class scope, member functions and member function templates in the
|
| 263 |
derived class override and/or hide member functions and member function
|
| 264 |
templates with the same name, parameter-type-list ([[dcl.fct]]),
|
| 265 |
cv-qualification, and *ref-qualifier* (if any) in a base class (rather
|
| 266 |
+
than conflicting). For *using-declaration*s that name a constructor,
|
| 267 |
see [[class.inhctor]].
|
| 268 |
|
| 269 |
``` cpp
|
| 270 |
struct B {
|
| 271 |
virtual void f(int);
|