Repository navigation
Expand file tree
/
Copy pathifndr.tex
More file actions
1060 lines (890 loc) · 29.8 KB
/
Copy pathifndr.tex
File metadata and controls
1060 lines (890 loc) · 29.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%!TEX root = std.tex
\infannex{ifndr}{Ill-formed, no diagnostic required}
\rSec1[ifndr.general]{General}
\pnum
This Annex documents
rules for which no diagnostic is required,
called out in
\ref{intro} through \ref{\lastcorechapter}
using the following phrases:
\begin{itemize}
\item no diagnostic is required
\item no diagnostic required
\item a diagnostic is required only if
\end{itemize}
Each entry contains
a title,
a cross-reference,
a summary of the circumstances,
and code examples.
The code examples are not intended
to exhaustively cover all possible ways of invoking that case.
\rSec1[ifndr.lex]{\ref*{lex}: Lexical conventions}
\ifndrdescription{lex.name.reserved}
\pnum
Using an identifier reserved for use by \Cpp{}
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
int _z; // IFNDR, \tcode{_z} is reserved because it starts with \tcode{_} at global scope
int main() {
int __x; // IFNDR, \tcode{__x} is reserved because it starts with \tcode{__}
int _Y; // IFNDR, \tcode{_Y} is reserved because it starts with \tcode{_} followed by a capital letter
int x__y; // IFNDR, \tcode{x__y} is reserved because it contains \tcode{__}
}
\end{codeblock}
\end{example}
\rSec1[ifndr.basic]{\ref*{basic}: Basics}
\ifndrdescription{basic.link.consistent.types}
\pnum
Having multiple declarations of the same entity
with different kinds
when those declarations are not reachable from one another
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Module interface of \tcode{M}}
void g(); // \#1
void h(); // \#2
template <typename T> int j; // \#3
\end{codeblocktu}
\begin{codeblocktu}{Module interface of \tcode{N}}
int g(); // same entity as \#1, different type
namespace h {} // same entity as \#2, not both namespaces
template <int X> int j; // same entity as \#3, non-equivalent template heads
\end{codeblocktu}
\begin{codeblocktu}{Other translation unit}
import M;
import N;
// IFNDR due to the mismatched pairs above
\end{codeblocktu}
\end{example}
\ifndrdescription{basic.def.odr.minimum.one.def}
\pnum
Not having a definition
for a function or variable
that is odr-used from a non-discarded statement\iref{stmt.if}
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
auto f() {
struct A {};
return A{};
}
decltype(f()) g();
auto x = g(); // IFNDR, function \tcode{g} is used but not defined in this translation unit, and cannot
// be defined in any other translation unit because its type does not have linkage
\end{codeblock}
\end{example}
\ifndrdescription{basic.def.odr.injected.match}
\pnum
Defining a definable item \tcode{D}
with an injected declaration\iref{expr.const.reflect}
in one translation unit and
a definition in a different translation unit
when \tcode{D} is not attached to a named module
or neither definition is reachable from the other
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
struct S;
consteval { std::meta::define_aggregate(^^S, {}); } // \#1
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
struct S {}; // IFNDR, definition here, injected declaration at \#1
\end{codeblocktu}
\end{example}
\ifndrdescription{basic.def.odr.maximum.one.def}
\pnum
If there are definitions
in different translation units
of a non-inline non-templated function or variable
that are not attached to a named module
or are not reachable from one another,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
export module M:A; // module partition
void f() {} // \#1
void g() {} // \#2
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
export module M:B; // module partition
void f() {} // IFNDR, \#1 not reachable
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#3}
export module M; // primary module interface unit
export import :A;
void g(); // error: \#2 is reachable
\end{codeblocktu}
\end{example}
\ifndrdescription{basic.def.odr.definition.matches}
\pnum
If there are definitions
in different translation units
of a definable item \tcode{D}
where
\begin{itemize}
\item \tcode{D} is not defined by an injected declaration\iref{expr.const.reflect},
\item \tcode{D} is not an inline or templated function or variable, and
\item \tcode{D} is not attached to a named module or the declarations are not reachable from one another,
\end{itemize}
that do not satisfy the matching rules described in \ref{basic.def.odr},
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
inline void f() {} // \#1
inline void g() {} // \#2
inline void h() {[]{}();} // \#3
namespace { int i = 0; }
inline void j() {++i;} // \#4
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
inline void f() {} // OK, same as \#1
inline void g() {;} // IFNDR, different sequence of tokens than \#2
inline void h() {[]{}();} // IFNDR, closure has different type than \#3
namespace { int i = 0; }
inline void j() {++i; } // IFNDR, \tcode{i} refers to different entity than in \#4
\end{codeblocktu}
\end{example}
\ifndrdescription{basic.def.odr.unnamed.enum.same.type}
\pnum
Having multiple unnamed enumeration definitions
in the same scope
that have the same first enumerator name
and do not have typedef names for linkage purposes\iref{dcl.enum}
that are not the same enumeration
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Source file \tcode{"a.h"}}
enum { a };
\end{codeblocktu}
\begin{codeblocktu}{Source file \tcode{"b.h"}}
enum { a, b };
\end{codeblocktu}
\begin{codeblocktu}{Source file \tcode{"main.cpp"}}
import "a.h";
import "b.h";
auto n = decltype(a)::b; // IFNDR, more than one unnamed enum definition reachable at
// this point but their types are not the same
\end{codeblocktu}
\end{example}
\ifndrdescription{basic.contract.vastart.contract.predicate}
\pnum
The use of \tcode{va_start}\iref{cstdarg.syn}
within the predicate of a contract assertion
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
void f(...)
{
va_list args;
contract_assert((va_start(const_cast<decltype(args)>(args)), true)) // IFNDR
}
\end{codeblock}
\end{example}
\ifndrdescription{basic.contract.handler.replacing.nonreplaceable}
\pnum
On platforms where
the contract-violation handler
is not replaceable\iref{dcl.fct.def.replace}
a function declaration which could be such a replacement function
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
#include <contracts>
void handle_contract_violation(const std::contracts::contract_violation& violation);
// IFNDR, if contract-violation handler is not replaceable
\end{codeblock}
\end{example}
\ifndrdescription{class.member.lookup.name.refers.diff.decl}
\pnum
A name $N$ used in a class $S$
referring to a different declaration when resolved in its context
than when re-evaluated in the completed scope of $S$
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
struct foo {};
struct bar {
foo *m_foo;
foo *foo() {
return m_foo;
} // IFNDR, \tcode{foo} now refers to member function \tcode{foo()} while previously referred to \tcode{struct} \tcode{foo}
};
\end{codeblock}
\end{example}
\begin{example}
\begin{codeblock}
struct B {
static int f();
};
struct D : public B {
using B::f;
int g(decltype(f()) x) {
return 0;
} // IFNDR, \tcode{decltype(f())} will refer to \tcode{B::f()} here but if
// moved to the end of \tcode{D} it would refer to \tcode{D::f()}
static float f();
};
int main() {
D d;
return d.g(0);
}
\end{codeblock}
\end{example}
\rSec1[ifndr.expr]{\ref*{expr}: Expressions}
\ifndrdescription{expr.prim.req.always.sub.fail}
\pnum
If the substitution of template arguments
into a \grammarterm{requirement}
would always result in a substitution failure,
the program is ill-formed; no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template <typename T> concept C = requires {
new int[-(int)sizeof(T)]; // IFNDR, the size of the allocation is required to be greater
// than zero but can never be
};
\end{codeblock}
\end{example}
\rSec1[ifndr.stmt]{\ref*{stmt}: Statements}
\ifndrdescription{stmt.ambig.bound.diff.parse}
\pnum
If, during
parsing, a name in a template parameter is bound differently than it would be bound during a trial parse,
the program is ill-formed. No diagnostic is required.
\pnum
\begin{example}
\begin{codeblock}
template <int N> struct A { const static int a = 20; };
template <> struct A<100> { using a = char; };
const int x = 10;
int main() {
using T = const int;
T(x)
(100), (y)(A<x>::a); // IFNDR, during trial parse the template parameter \tcode{x} is bound to
// the global \tcode{x} later during parsing the template parameter \tcode{x}
// is bound to the local \tcode{x} declared on the same line
}
\end{codeblock}
\end{example}
\rSec1[ifndr.dcl]{\ref*{dcl}: Declarations}
\ifndrdescription{dcl.constinit.specifier.not.reachable}
\pnum
If the initializing declaration
of a variable without the \tcode{constinit} specifier
has the \tcode{constinit} specifier
applied to declarations that are not reachable from
that initializing declaration,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
int x = 5; // initializing declaration of \tcode{x}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
extern constinit int x; // IFNDR, not reachable from initializing declaration of \tcode{x}
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.inline.missing.on.definition}
\pnum
If a function or variable
with external or module linkage
is declared inline
but there is no inline declaration
reachable from the end of some definition domain
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
inline int f();
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
int f() { return 17; }
// IFNDR, end of definition domain but no inline declaration of \tcode{f} is reachable
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.fct.default.inline.same.defaults}
\pnum
If the accumulated set of default arguments
for a given inline function
with definitions in multiple translation units
is different at the end
of different translation units,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
inline int f(int x, int y = 2);
inline int f(int x = 1, int y);
// IFNDR, default arguments of \tcode{f} are \tcode{1} and \tcode{2}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
inline int f(int x = 3, int y = 4);
// IFNDR, default arguments of \tcode{f} are \tcode{3} and \tcode{4}
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.contract.func.mismatched.contract.specifiers}
\pnum
If two different first declarations of a function
(which must therefore not be reachable from one another)
do not have equivalent function contract specifiers
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
int f(int x) pre(x >= 0); // IFNDR, \tcode{pre} present, not present in the other first declaration of \tcode{f}
int g(int x) pre(x == 0); // IFNDR, \tcode{pre} differs from the other first declaration of \tcode{g}
int h(int x) pre(x <= 0); // OK, \tcode{pre} equivalent to \tcode{pre} on the other first declaration of \tcode{h}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
int f(int x); // IFNDR, \tcode{pre} not present, present in the other first declaration of \tcode{f}
int g(int x) pre(x != 0); // IFNDR, \tcode{pre} differs from the other first declaration of \tcode{g}
int h(int y) pre(y <= 0); // OK, \tcode{pre} equivalent to \tcode{pre} on the other first declaration of \tcode{h}
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.fct.def.replace.bad.replacement}
\pnum
A declaration of a replaceable function
that is inline,
not attached to the global module,
does not have \Cpp{} language linkage,
does not have the required return type,
or is not a valid redeclaration of the
corresponding declaration in a standard library header (if there is one)
then the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
extern "C" // IFNDR, wrong language linkage
inline // IFNDR, inline
int // IFNDR, wrong return type
handle_contract_violation(const std::contracts::contract_violation&) {}
void* operator new(decltype(sizeof(0))) noexcept; // IFNDR, mismatched exception specification to
// declaration in \tcode{<new>}
\end{codeblock}
\end{example}
\ifndrdescription{dcl.link.mismatched.language.linkage}
\pnum
If two declarations of an entity
do not have the same language linkage
and neither is reachable from the other
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
extern "C" { void f(); }
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
extern "C++" { void f(); } // IFNDR, different language linkage
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.align.diff.translation.units}
\pnum
No diagnostic is required if declarations of an entity have different \grammarterm{alignment-specifier}s in different
translation units.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
struct S { int x; } s, *p = &s;
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
struct alignas(16) S; // IFNDR, definition of \tcode{S} lacks alignment
extern S* p;
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.attr.indet.mismatched.declarations}
\pnum
If two first declarations of a function
declare a function parameter with
mismatched uses of the \tcode{indeterminate} attribute,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
int h(int x [[indeterminate]]); // IFNDR, mismatched \tcode{[[indeterminate]]} to other first declaration of \tcode{h}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
int h(int x); // IFNDR, mismatched \tcode{[[indeterminate]]} to other first declaration of \tcode{h}
\end{codeblocktu}
\end{example}
\ifndrdescription{dcl.attr.noreturn.trans.unit.mismatch}
\pnum
No diagnostic is required if a function is declared
in one translation unit with the \tcode{noreturn} attribute
but has declarations in other translation units
without the attribute.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
[[noreturn]] void f() {}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
void f(); // IFNDR, declared without \tcode{noreturn}
\end{codeblocktu}
\end{example}
\rSec1[ifndr.module]{\ref*{module}: Modules}
\ifndrdescription{module.unit.reserved.identifiers}
\pnum
Specifying a \grammarterm{module-name}
beginning with an identifier
consisting of \tcode{std} followed by zero or more digits,
or containing a reserved identifier\iref{lex.token}
in a \grammarterm{module-declaration}
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
module std; // IFNDR, \tcode{std} is not allowed at the beginning
module module; // IFNDR, \tcode{module} is a reserved identifier
module std0; // IFNDR, \tcode{std} followed by digits is not allowed at the beginning
export module _Test; // IFNDR, \tcode{_Test} is a reserved identifier
export module te__st; // IFNDR, \tcode{te__st} is a reserved identifier
\end{codeblock}
\end{example}
\ifndrdescription{module.unit.named.module.no.partition}
\pnum
Having multiple primary module interface units
for a named module
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
module A;
export import :Internals; // IFNDR, module partition not allowed
\end{codeblock}
\end{example}
\ifndrdescription{module.unit.unexported.module.partition}
\pnum
If a module partition of a module
that is a module interface unit
but is not directly or indirectly exported
by the primary module interface unit\iref{module.import},
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
export module M; // primary module interface unit
export import :A;
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
export module M:A; // OK, directly exported by \tcode{M}
export import :B;
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#3}
export module M:B; // OK, indirectly exported by \tcode{M}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#4}
export module M:C; // IFNDR, not directly or indirectly exported by \tcode{M}
\end{codeblocktu}
\end{example}
\ifndrdescription{module.private.frag.other.module.units}
\pnum
If a module has a private module fragment
and there is another module unit of that module,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
export module M;
module :private; // private module fragment
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
module M:A; // IFNDR, partition of \tcode{M} with private module fragment
\end{codeblocktu}
\end{example}
\rSec1[ifndr.class]{\ref*{class}: Classes}
\ifndrdescription{class.base.init.delegate.itself}
\pnum
If a constructor delegates to itself directly or indirectly,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
struct C {
C( int ) { } // \#1: non-delegating constructor
C(): C(42) { } // \#2: delegates to \#1
C( char c ) : C(42.0) { } // \#3: IFNDR due to recursion with \#4
C( double d ) : C('a') { } // \#4: IFNDR due to recursion with \#3
};
\end{codeblock}
\end{example}
\ifndrdescription{class.virtual.pure.or.defined}
\pnum
If a virtual function that is not pure
has no definition,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
class A {
virtual void f();
};
int main() {
A a; // IFNDR, virtual function that is not pure but has no definition
}
\end{codeblock}
\end{example}
\rSec1[ifndr.over]{\ref*{over}: Overloading}
\ifndrdescription{over.literal.reserved}
\pnum
Some literal suffix identifiers are
reserved for future standardization. A declaration whose \grammarterm{literal-operator-id} uses such a literal
suffix identifier is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
float operator ""E(const char*); // IFNDR, reserved literal suffix
double operator"" _Bq(long double); // IFNDR, uses the reserved identifier \tcode{_Bq}
\end{codeblock}
\end{example}
\rSec1[ifndr.temp]{\ref*{temp}: Templates}
\ifndrdescription{temp.pre.reach.def}
\pnum
A definition of a function template,
member function of a class template,
variable template,
or static data member of a class template
that is not reachable from
the end of every definition domain\iref{basic.def.odr}
in which it is implicitly instantiated\iref{temp.inst}
and whose corresponding specialization
is not explicitly instantiated\iref{temp.explicit} in some translation unit
is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Source file \tcode{"a.h"}}
template <typename T>
void f();
\end{codeblocktu}
\begin{codeblocktu}{Source file \tcode{"a.cpp"}}
#include "a.h"
int main() {
f<int>(); // IFNDR, function template implicitly instantiated but not reachable definition
}
\end{codeblocktu}
\end{example}
\ifndrdescription{temp.arg.template.sat.constraints}
\pnum
Any partial specializations\iref{temp.spec.partial}
associated with the primary template are considered when a specialization
based on the template template-parameter is instantiated.
If a specialization is not reachable
from the point of instantiation,
and it would have been selected had it been reachable,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template<class T> struct A {
int x;
};
template<template<class U> class V> struct C {
V<int> y;
V<int*> z;
};
C<A> c;
// IFNDR, specialization is not reachable from point of instantiation above and it would have
// been selected if it had
template<class T> struct A<T*> {
long x;
};
\end{codeblock}
\end{example}
\ifndrdescription{temp.constr.atomic.equiv.but.not.equiv}
\pnum
If the validity or meaning of the program
depends on whether two atomic constraints are equivalent,
and they are functionally equivalent but not equivalent,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template <int N> concept Add1 = true;
template <unsigned N> void f2()
requires Add1<2 * N>;
template <unsigned N> int f2()
requires Add1<N * 2> && true;
void h2() {
f2<0>(); // IFNDR, requires determination of subsumption between atomic constraints
// that are functionally equivalent but not equivalent
}
\end{codeblock}
\end{example}
\ifndrdescription{temp.constr.atomic.sat.result.diff}
\pnum
If, at different points in the program,
the satisfaction result is different
for identical atomic constraints and template arguments,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template<class T>
concept Complete = sizeof(T) == sizeof(T);
struct A;
static_assert(!Complete<A>); // \#1
struct A {};
static_assert(Complete<A>); // IFNDR, satisfaction result differs from point \#1
\end{codeblock}
\end{example}
\ifndrdescription{temp.constr.normal.invalid}
\pnum
If during constraint normalization
any such substitution results in an invalid type or expression,
the program is ill-formed, no diagnostic is required.
\pnum
\begin{example}
\begin{codeblock}
template<typename T> concept A = T::value || true;
template<typename U> concept B = A<U*>;
template<typename V> concept C = B<V&>; // IFNDR, it would form the invalid type \tcode{V\&*}
// in the parameter mapping
\end{codeblock}
\end{example}
\ifndrdescription{temp.spec.partial.general.partial.reachable}
\pnum
If a partial specialization
is not reachable from a use of a template specialization
that would make use of that partial specialization
as the result of an implicit or explicit instantiation,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template<typename T> class X{
public:
void foo(){};
};
template class X<void *>; // IFNDR, explicit instantiation and partial specialization is not reachable
template<typename T> class X<T*>{
public:
void baz();
};
\end{codeblock}
\end{example}
\ifndrdescription{temp.over.link.equiv.not.equiv}
\pnum
If the validity or meaning of the program
depends on whether two constructs are equivalent,
and they are functionally equivalent but not equivalent,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template <int I>
struct A{};
// IFNDR, the following declarations are functionally equivalent but not equivalent
template <int I> void f(A<I>, A<I+10>);
template <int I> void f(A<I>, A<I+1+2+3+4>);
\end{codeblock}
\end{example}
\ifndrdescription{temp.res.general.default.but.not.found}
\pnum
If the validity or meaning of the program
would be changed by considering
a default argument or default template argument
introduced in a declaration that is reachable
from the point of instantiation of a specialization\iref{temp.point}
but is not found by lookup for the specialization,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
void f(long); // \#1
void f(int, int); // \#2
template<typename T> void g(T t) { f(t); }
void f(int, int = 0); // \#3
void h() { g(0); } // IFNDR, selects \#3 here but selects \#1 using lookup for \tcode{g<int>}
\end{codeblock}
\end{example}
\ifndrdescription{temp.point.diff.pt.diff.meaning}
\pnum
A specialization for a class template has
at most one point of instantiation within a translation unit.
A specialization for any template
may have points of instantiation in multiple translation units.
If two different points of instantiation
give a template specialization
different meanings according to the one-definition rule\iref{basic.def.odr},
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Source file \tcode{"a.h"}}
#include <type_traits>
template <typename T, typename Enabler = void>
struct is_complete : std::false_type {};
template <typename T>
struct is_complete<T, std::void_t<decltype(sizeof(T) != 0)>> : std::true_type {};
\end{codeblocktu}
\begin{codeblocktu}{Source file \tcode{"a.cpp"}}
#include "a.h"
struct X;
static_assert(!is_complete<X>::value); // IFNDR, different specialization selected in \tcode{"b.cpp"}
\end{codeblocktu}
\begin{codeblocktu}{Source file \tcode{"b.cpp"}}
#include "a.h"
struct X { };
static_assert(is_complete<X>::value); // IFNDR, different specialization selected in \tcode{"a.cpp"}
\end{codeblocktu}
\end{example}
\ifndrdescription{temp.dep.candidate.different.lookup.different}
\pnum
If considering all function declarations
with external linkage
in the associated namespaces in all translations
would make a dependent call\iref{temp.dep} ill-formed
or find a better match,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Translation unit \#1}
namespace A {
struct S {};
void f(S&, long x, int y); // \#3
void g(S&, int x); // \#4
}
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
namespace A {
struct S {};
void f(S&, int x, long y); // \#5
void g(S&, long x); // \#6
}
template <typename T>
void h(T& t)
{
f(t, 1, 1); // Selects \#5 in \tcode{h<A::S>}, would be ambiguous call if all declarations were considered.
g(t, 1); // Selects \#6 in \tcode{h<A::S>}, would select \#4 if all declarations were considered.
}
\end{codeblocktu}
\end{example}
\ifndrdescription{temp.explicit.decl.implicit.inst}
\pnum
If an entity that is the subject of
an explicit instantiation declaration
and that is also used
in a way that would otherwise cause an implicit
instantiation\iref{temp.inst}
in the translation unit
is not the subject of
an explicit instantiation definition somewhere in the program
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
extern template class std::vector<int>; // explicit instantiation declaration
int main() {
std::cout << std::vector<int>().size(); // IFNDR, implicit instantiation but no explicit
// instantiation definition
}
\end{codeblock}
\end{example}
\ifndrdescription{temp.expl.spec.unreachable.declaration}
\pnum
If an implicit instantiation of a template would occur
and there is an unreachable explicit specialization
that would have matched,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblocktu}{Source file \tcode{"a.h"}}
template <typename T> struct S {};
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#2}
#include "a.h"
template <> struct S<int> { int oops; }; // \#1
\end{codeblocktu}
\begin{codeblocktu}{Translation unit \#3}
#include "a.h"
S<int> s; // IFNDR, \#1 is not reachable but would have matched
\end{codeblocktu}
\end{example}
\ifndrdescription{temp.expl.spec.missing.definition}
\pnum
If an explicit specialization of a template is
declared but there is no definition provided
for that specialization,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template <typename T> int f(T&&) { return 0; }
template <> int f<int>(int&&);
int j = f(1); // IFNDR, odr-use of \tcode{f<int>} with no definition
\end{codeblock}
\end{example}
\ifndrdescription{temp.deduct.general.diff.order}
\pnum
If substitution
into different declarations
of the same function template
would cause template instantiations to occur
in a different order or not at all,
the program is ill-formed, no diagnostic required.
\pnum
\begin{example}
\begin{codeblock}
template <class T> struct A { using X = typename T::X; };
template <class T> typename T::X h(typename A<T>::X); // \#1
template <class T> auto h(typename A<T>::X) -> typename T::X; // redeclaration \#2