File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 2440
2440
\pnum
2441
2441
The name of a function declared in block scope and the name of a variable declared by a
2442
2442
block scope \tcode {extern} declaration have linkage. If there is a visible declaration
2443
- of an entity with linkage having the same name and type, ignoring entities declared
2444
- outside the innermost enclosing namespace scope, the block scope declaration declares
2443
+ of an entity with linkage, ignoring entities declared
2444
+ outside the innermost enclosing namespace scope,
2445
+ such that the block scope declaration would be
2446
+ a (possibly ill-formed) redeclaration
2447
+ if the two declarations appeared in the same declarative region,
2448
+ the block scope declaration declares
2445
2449
that same entity and receives the linkage of the previous declaration. If there is more
2446
2450
than one such matching entity, the program is ill-formed. Otherwise, if no matching
2447
2451
entity is found, the block scope entity receives external linkage.
2450
2454
\begin {example }
2451
2455
\begin {codeblock }
2452
2456
static void f();
2457
+ extern "C" void h();
2453
2458
static int i = 0; // \# 1
2454
2459
void g() {
2455
2460
extern void f(); // internal linkage
2461
+ extern void h(); // C language linkage
2456
2462
int i; // \# 2: \tcode {i} has no linkage
2457
2463
{
2458
2464
extern void f(); // internal linkage
You can’t perform that action at this time.
0 commit comments