File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 2470
2470
\item it is a cv-qualified\iref {basic.type.qualifier } version of a
2471
2471
type that has linkage.
2472
2472
\end {itemize }
2473
- A type without linkage shall not be used as the type of a variable or
2474
- function with external linkage unless
2475
- \begin {itemize }
2476
- \item the entity has C language linkage\iref {dcl.link }, or
2477
-
2478
- \item the entity is not odr-used\iref {basic.def.odr } or is defined in
2479
- the same translation unit.
2480
- \end {itemize }
2481
2473
\begin {note }
2482
2474
In other words, a type without linkage contains a class or enumeration that
2483
- cannot be named outside its translation unit. An entity with external linkage declared
2484
- using such a type could not correspond to any other entity in another translation unit
2485
- of the program and thus must be defined in the
2486
- translation unit if it is odr-used. Also note that classes with linkage may contain members
2487
- whose types do not have linkage, and that typedef names are ignored in the determination
2475
+ cannot be named outside its translation unit.
2476
+ Classes with linkage may contain members
2477
+ whose types do not have linkage.
2478
+ Typedef names are ignored in the determination
2488
2479
of whether a type has linkage.
2489
2480
\end {note }
2490
2481
2501
2492
A a = { 1 };
2502
2493
B<A> ba; // declares \tcode {B<A>::g(A)} and \tcode {B<A>::h(A)}
2503
2494
ba.g(a); // OK
2504
- ba.h(a); // error: \tcode {B<A>::h(A) not defined in the translation unit}
2495
+ ba.h(a); // error: \tcode {B<A>::h(A)} not defined; \tcode {A} cannot be named in another translation unit
2505
2496
i(ba, a); // OK
2506
2497
}
2507
2498
\end {codeblock }
You can’t perform that action at this time.
0 commit comments