1 // RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98,cxx98-14 -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy
2 // RUN: %clang_cc1 -std=c++11 %s -verify=expected,since-cxx11,cxx98-14,cxx11-14 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
3 // RUN: %clang_cc1 -std=c++14 %s -verify=expected,since-cxx11,cxx98-14,cxx11-14 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
4 // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
5 // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
6 // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
8 #if __cplusplus == 199711L
9 #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
10 // cxx98-error@-1 {{variadic macros are a C99 feature}}
13 namespace cwg1
{ // cwg1: no
14 namespace X
{ extern "C" void cwg1_f(int a
= 1); }
15 namespace Y
{ extern "C" void cwg1_f(int a
= 1); }
16 using X::cwg1_f
; using Y::cwg1_f
;
19 // FIXME: This should be rejected, due to the ambiguous default argument.
26 // FIXME: This should be rejected, due to the ambiguous default argument.
34 void X::z(int = 1) {} // #cwg1-z
37 // expected-error@-1 {{redefinition of default argument}}
38 // expected-note@#cwg1-z {{previous definition is here}}
46 // FIXME: This should be rejected, due to the ambiguous default argument.
53 // FIXME: This should be rejected, due to the ambiguous default argument.
58 namespace cwg3
{ // cwg3: yes
59 template<typename T
> struct A
{};
60 template<typename T
> void f(T
) { A
<T
> a
; } // #cwg3-f-T
62 template<> struct A
<int> {};
63 // expected-error@-1 {{explicit specialization of 'cwg3::A<int>' after instantiation}}
64 // expected-note@#cwg3-f-T {{implicit instantiation first required here}}
67 namespace cwg4
{ // cwg4: 2.8
69 static void cwg4_f(int) {}
70 static void cwg4_f(float) {}
71 void cwg4_g(int) {} // #cwg4-g-int
73 // expected-error@-1 {{conflicting types for 'cwg4_g'}}
74 // expected-note@#cwg4-g-int {{previous definition is here}}
78 namespace cwg5
{ // cwg5: 3.1
84 const volatile B b
= a
;
88 struct E
{ operator D
&(); } e
;
92 namespace cwg7
{ // cwg7: 3.4
93 class A
{ public: ~A(); };
94 class B
: virtual private A
{}; // #cwg7-B
95 class C
: public B
{} c
; // #cwg7-C
96 // expected-error@#cwg7-C {{inherited virtual base class 'A' has private destructor}}
97 // expected-note@#cwg7-C {{in implicit default constructor for 'cwg7::C' first required here}}
98 // expected-note@#cwg7-B {{declared private here}}
99 // expected-error@#cwg7-C {{inherited virtual base class 'A' has private destructor}}
100 // expected-note@#cwg7-C {{in implicit destructor for 'cwg7::C' first required here}}
101 // expected-note@#cwg7-B {{declared private here}}
102 class VeryDerivedC
: public B
, virtual public A
{} vdc
;
104 class X
{ ~X(); }; // #cwg7-X
105 class Y
: X
{ ~Y() {} };
106 // expected-error@-1 {{base class 'X' has private destructor}}
107 // expected-note@#cwg7-X {{implicitly declared private here}}
109 namespace PR16370
{ // This regressed the first time CWG7 was fixed.
110 struct S1
{ virtual ~S1(); };
113 struct S4
: virtual S2
{};
122 namespace cwg8
{ // cwg8: dup 45
125 static const int k
= 5;
127 template<typename
, int, void (A::*)()> struct T
;
131 A::T
<A::U
, A::k
, &A::f
> *A::g() { return 0; }
134 namespace cwg9
{ // cwg9: 2.8
140 struct N
: protected B
{ // #cwg9-N
143 int R1() { return n
.m
; }
144 // expected-error@-1 {{'m' is a protected member of 'cwg9::B'}}
145 // expected-note@#cwg9-N {{constrained by protected inheritance here}}
146 // expected-note@#cwg9-m {{member is declared here}}
147 int R2() { return n
.m
; }
150 namespace cwg10
{ // cwg10: dup 45
158 namespace cwg11
{ // cwg11: yes
159 template<typename T
> struct A
: T
{
163 template<typename T
> struct B
: T
{
166 // expected-error@-1 {{unknown type name 'V'}}
168 struct X
{ typedef int U
; };
172 namespace cwg12
{ // cwg12: sup 239
177 // Under CWG12, these call two different functions.
178 // Under CWG239, they call the same function.
184 namespace cwg13
{ // cwg13: no
185 extern "C" void f(int);
188 template<typename T
> struct A
{
191 template<typename T
> int h(void (T
));
193 A
<int> a1(f
); // FIXME: We should reject this.
195 int a3
= h(f
); // FIXME: We should reject this.
199 namespace cwg14
{ // cwg14: 3.4
200 namespace X
{ extern "C" int cwg14_f(); }
201 namespace Y
{ extern "C" int cwg14_f(); }
208 friend int Y::cwg14_f();
211 extern "C" int cwg14_f() { return c
.k
; }
214 namespace X
{ typedef int T
; typedef int U
; } // #cwg14-X-U
215 namespace Y
{ typedef int T
; typedef long U
; } // #cwg14-Y-U
216 T t
; // ok, same type both times
218 // expected-error@-1 {{reference to 'U' is ambiguous}}
219 // expected-note@#cwg14-X-U {{candidate found by name lookup is 'cwg14::X::U'}}
220 // expected-note@#cwg14-Y-U {{candidate found by name lookup is 'cwg14::Y::U'}}
223 namespace cwg15
{ // cwg15: yes
224 template<typename T
> void f(int); // #cwg15-f-decl-first
225 template<typename T
> void f(int = 0);
226 // expected-error@-1 {{default arguments cannot be added to a function template that has already been declared}}
227 // expected-note@#cwg15-f-decl-first {{previous template declaration is here}}
230 namespace cwg16
{ // cwg16: 2.8
231 class A
{ // #cwg16-A
232 void f(); // #cwg16-A-f-decl
235 class B
: A
{}; // #cwg16-B
239 // expected-error@-1 {{'f' is a private member of 'cwg16::A'}}
240 // expected-note@#cwg16-B {{constrained by implicitly private inheritance here}}
241 // expected-note@#cwg16-A-f-decl {{member is declared here}}
242 A::f(); // #cwg16-A-f-call
243 // expected-error@#cwg16-A-f-call {{'A' is a private member of 'cwg16::A'}}
244 // expected-note@#cwg16-B {{constrained by implicitly private inheritance here}}
245 // expected-note@#cwg16-A {{member is declared here}}
246 // expected-error@#cwg16-A-f-call {{cannot cast 'cwg16::C' to its private base class 'cwg16::A'}}
247 // expected-note@#cwg16-B {{implicitly declared private here}}
252 namespace cwg17
{ // cwg17: yes
259 int A::f() { return b
.n
; }
261 int g() { return n
; }
267 namespace cwg19
{ // cwg19: 3.1
271 struct B
: protected A
{ // #cwg19-B
275 int get1() { return c
.n
; }
276 // expected-error@-1 {{'n' is a protected member of 'cwg19::A'}}
277 // expected-note@#cwg19-B {{constrained by protected inheritance here}}
278 // expected-note@#cwg19-n {{member is declared here}}
279 int get2() { return ((A
&)c
).n
; } // ok, A is an accessible base of B from here
283 namespace cwg20
{ // cwg20: 2.8
288 X(const X
&); // #cwg20-X-ctor
292 // expected-error@-1 {{calling a private constructor of class 'cwg20::X'}}
293 // expected-note@#cwg20-X-ctor {{declared private here}}
296 namespace cwg21
{ // cwg21: 3.4
297 template<typename T
> struct A
;
299 template<typename T
= int> friend struct A
;
300 // expected-error@-1 {{default template argument not permitted on a friend template}}
301 template<typename T
= int> friend struct B
;
302 // expected-error@-1 {{default template argument not permitted on a friend template}}
306 namespace cwg22
{ // cwg22: sup 481
307 template<typename cwg22_T
= cwg22_T
> struct X
;
308 // expected-error@-1 {{unknown type name 'cwg22_T'}}
310 template<typename T
= T
> struct Y
;
313 namespace cwg23
{ // cwg23: yes
314 template<typename T
> void f(T
, T
); // #cwg23-f-T-T
315 template<typename T
> void f(T
, int); // #cwg23-f-T-int
316 void g() { f(0, 0); }
317 // expected-error@-1 {{call to 'f' is ambiguous}}
318 // expected-note@#cwg23-f-T-T {{candidate function [with T = int]}}
319 // expected-note@#cwg23-f-T-int {{candidate function [with T = int]}}
324 namespace cwg25
{ // cwg25: yes
327 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
328 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
330 void (A::*f
)() throw (int);
331 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
332 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
333 void (A::*g
)() throw () = f
;
334 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
335 // since-cxx17-error@-2 {{different exception specifications}}
336 void (A::*g2
)() throw () = 0;
337 void (A::*h
)() throw (int, char) = f
;
338 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
339 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
340 void (A::*i
)() throw () = &A::f
;
341 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
342 // since-cxx17-error@-2 {{different exception specifications}}
343 void (A::*i2
)() throw () = 0;
344 void (A::*j
)() throw (int, char) = &A::f
;
345 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
346 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
349 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
350 // since-cxx17-error@-2 {{different exception specifications}}
353 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
354 // since-cxx17-error@-2 {{different exception specifications}}
359 namespace cwg26
{ // cwg26: yes
360 struct A
{ A(A
, const A
& = A()); };
361 // expected-error@-1 {{copy constructor must pass its first argument by reference}}
364 // FIXME: In C++98, we diagnose this twice.
365 B(const B
&, B
= B());
366 // cxx98-14-error@-1 {{recursive evaluation of default argument}}
367 // cxx98-14-note@-2 {{default argument used here}}
368 // cxx98-error@-3 {{recursive evaluation of default argument}}
369 // cxx98-note@-4 {{default argument used here}}
373 C(const C
&, C
= f());
374 // expected-error@-1 {{recursive evaluation of default argument}}
375 // expected-note@-2 {{default argument used here}}
379 namespace cwg27
{ // cwg27: yes
386 namespace cwg29
{ // cwg29: 3.4
387 void cwg29_f0(); // #cwg29-f0
388 void g0() { void cwg29_f0(); }
389 extern "C++" void g0_cxx() { void cwg29_f0(); }
390 extern "C" void g0_c() { void cwg29_f0(); }
391 // expected-error@-1 {{declaration of 'cwg29_f0' has a different language linkage}}
392 // expected-note@#cwg29-f0 {{previous declaration is here}}
394 extern "C" void cwg29_f1(); // #cwg29-f1
395 void g1() { void cwg29_f1(); }
396 extern "C" void g1_c() { void cwg29_f1(); }
397 extern "C++" void g1_cxx() { void cwg29_f1(); }
398 // expected-error@-1 {{declaration of 'cwg29_f1' has a different language linkage}}
399 // expected-note@#cwg29-f1 {{previous declaration is here}}
401 void g2() { void cwg29_f2(); } // #cwg29-f2
402 extern "C" void cwg29_f2();
403 // expected-error@-1 {{declaration of 'cwg29_f2' has a different language linkage}}
404 // expected-note@#cwg29-f2 {{previous declaration is here}}
406 extern "C" void g3() { void cwg29_f3(); } // #cwg29-f3
407 extern "C++" void cwg29_f3();
408 // expected-error@-1 {{declaration of 'cwg29_f3' has a different language linkage}}
409 // expected-note@#cwg29-f3 {{previous declaration is here}}
411 extern "C++" void g4() { void cwg29_f4(); } // #cwg29-f4
412 extern "C" void cwg29_f4();
413 // expected-error@-1 {{declaration of 'cwg29_f4' has a different language linkage}}
414 // expected-note@#cwg29-f4 {{previous declaration is here}}
416 extern "C" void g5();
417 extern "C++" void cwg29_f5();
419 void cwg29_f5(); // ok, g5 is extern "C" but we're not inside the linkage-specification here.
422 extern "C++" void g6();
423 extern "C" void cwg29_f6();
425 void cwg29_f6(); // ok, g6 is extern "C" but we're not inside the linkage-specification here.
428 extern "C" void g7();
429 extern "C++" void cwg29_f7(); // #cwg29-f7
430 extern "C" void g7() {
432 // expected-error@-1 {{declaration of 'cwg29_f7' has a different language linkage}}
433 // expected-note@#cwg29-f7 {{previous declaration is here}}
436 extern "C++" void g8();
437 extern "C" void cwg29_f8(); // #cwg29-f8
438 extern "C++" void g8() {
440 // expected-error@-1 {{declaration of 'cwg29_f8' has a different language linkage}}
441 // expected-note@#cwg29-f8 {{previous declaration is here}}
445 namespace cwg30
{ // cwg30: sup 468 c++11
447 template<int> static int f();
449 // FIXME: It's not clear whether CWG468 applies to C++98 too.
450 int x
= A::template f
<0>();
451 // cxx98-error@-1 {{'template' keyword outside of a template}}
452 int y
= a
.template f
<0>();
453 // cxx98-error@-1 {{'template' keyword outside of a template}}
454 int z
= p
->template f
<0>();
455 // cxx98-error@-1 {{'template' keyword outside of a template}}
458 namespace cwg31
{ // cwg31: 2.8
461 void operator delete(void*); // #cwg31-delete
463 // We would call X::operator delete if X() threw (even though it can't,
464 // and even though we allocated the X using ::operator delete).
466 // expected-error@-1 {{'operator delete' is a private member of 'cwg31::X'}}
467 // expected-note@#cwg31-delete {{declared private here}}
472 namespace cwg33
{ // cwg33: 9
473 namespace X
{ struct S
; void f(void (*)(S
)); } // #cwg33-f-S
474 namespace Y
{ struct T
; void f(void (*)(T
)); } // #cwg33-f-T
476 template<typename Z
> Z
g(Y::T
);
478 // expected-error@-1 {{call to 'f' is ambiguous}}
479 // expected-note@#cwg33-f-S {{candidate function}}
480 // expected-note@#cwg33-f-T {{candidate function}}
482 template<typename T
> void t(X::S
);
483 template<typename T
, typename U
= void> void u(X::S
);
484 // expected-error@-1 0-1 {{default template arguments for a function template are a C++11 extension}}
485 void templ() { f(t
<int>); f(u
<int>); }
487 // Even though v<int> cannot select the first overload, ADL considers it
488 // and adds namespace Z to the set of associated namespaces, and then picks
489 // Z::f even though that function has nothing to do with any associated type.
490 namespace Z
{ struct Q
; void f(void(*)()); }
491 template<int> Z::Q
v();
492 template<typename
> void v();
493 void unrelated_templ() { f(v
<int>); }
495 namespace dependent
{
497 template<class T
> struct Y
{
498 friend int operator+(X
, void(*)(Y
)) {}
501 template<typename T
> void f(Y
<T
>);
502 int use
= X() + f
<int>;
503 // expected-error@-1 {{invalid operands to binary expression ('X' and 'void (Y<int>)')}}
508 struct Y
{ friend int operator+(Q
, Y (*)()); };
509 struct X
{ template<typename
> static Y
f(); };
510 int m
= Q() + X().f
<int>; // ok
511 int n
= Q() + (&(X().f
<int>)); // ok
518 namespace cwg36
{ // cwg36: 2.8
546 struct D
: virtual B
, virtual C
548 using B::i
; // #cwg36-ex2-B-i-first
550 // expected-error@-1 {{redeclaration of using declaration}}
551 // expected-note@#cwg36-ex2-B-i-first {{previous using declaration}}
553 using C::i
; // #cwg36-ex2-C-i-first
555 // expected-error@-1 {{redeclaration of using declaration}}
556 // expected-note@#cwg36-ex2-C-i-first {{previous using declaration}}
558 using B::j
; // #cwg36-ex2-B-j-first
560 // expected-error@-1 {{redeclaration of using declaration}}
561 // expected-note@#cwg36-ex2-B-j-first {{previous using declaration}}
563 using C::j
; // #cwg36-ex2-C-j-first
565 // expected-error@-1 {{redeclaration of using declaration}}
566 // expected-note@#cwg36-ex2-C-j-first {{previous using declaration}}
584 struct D
: virtual B
<T
>, virtual C
<T
>
586 using B
<T
>::i
; // #cwg36-ex3-B-i-first
588 // expected-error@-1 {{redeclaration of using declaration}}
589 // expected-note@#cwg36-ex3-B-i-first {{previous using declaration}}
591 using C
<T
>::i
; // #cwg36-ex3-C-i-first
593 // expected-error@-1 {{redeclaration of using declaration}}
594 // expected-note@#cwg36-ex3-C-i-first {{previous using declaration}}
596 using B
<T
>::j
; // #cwg36-ex3-B-j-first
598 // expected-error@-1 {{redeclaration of using declaration}}
599 // expected-note@#cwg36-ex3-B-j-first {{previous using declaration}}
601 using C
<T
>::j
; // #cwg36-ex3-C-j-first
603 // expected-error@-1 {{redeclaration of using declaration}}
604 // expected-note@#cwg36-ex3-C-j-first {{previous using declaration}}
615 using E
<T
>::k
; // #cwg36-E-k-first
617 // expected-error@-1 {{redeclaration of using declaration}}
618 // expected-note@#cwg36-E-k-first {{previous using declaration}}
625 namespace cwg38
{ // cwg38: yes
626 template<typename T
> struct X
{};
627 template<typename T
> X
<T
> operator+(X
<T
> a
, X
<T
> b
) { return a
; }
628 template X
<int> operator+<int>(X
<int>, X
<int>);
631 namespace cwg39
{ // cwg39: no
633 struct A
{ int &f(int); };
643 int &x(int); // #cwg39-A-x-decl
644 static int &y(int); // #cwg39-A-y-decl
649 struct B
: A
, virtual V
{
650 using A::x
; // #cwg39-using-A-x
652 using A::y
; // #cwg39-using-A-y
653 static float &y(float);
657 struct C
: A
, B
, virtual V
{} c
;
658 /* expected-warning@-1
659 {{direct base 'A' is inaccessible due to ambiguity:
660 struct cwg39::example2::C -> A
661 struct cwg39::example2::C -> B -> A}} */
663 // expected-error@-1 {{member 'x' found in multiple base classes of different types}}
664 // expected-note@#cwg39-A-x-decl {{member found by ambiguous name lookup}}
665 // expected-note@#cwg39-using-A-x {{member found by ambiguous name lookup}}
667 // FIXME: This is valid, because we find the same static data member either way.
669 // expected-error@-1 {{member 'y' found in multiple base classes of different types}}
670 // expected-note@#cwg39-A-y-decl {{member found by ambiguous name lookup}}
671 // expected-note@#cwg39-using-A-y {{member found by ambiguous name lookup}}
676 struct A
{ static int f(); };
677 struct B
: virtual A
{ using A::f
; };
678 struct C
: virtual A
{ using A::f
; };
679 struct D
: B
, C
{} d
;
684 struct A
{ int n
; }; // #cwg39-ex4-A-n
687 struct D
: B
, C
{ int f() { return n
; } };
689 {{non-static member 'n' found in multiple base-class subobjects of type 'A':
690 struct cwg39::example4::D -> B -> A
691 struct cwg39::example4::D -> C -> A}} */
692 // expected-note@#cwg39-ex4-A-n {{member found by ambiguous name lookup}}
696 // FIXME: This is valid.
697 struct A
{ int n
; }; // #cwg39-A-n
701 int k
= sizeof(D::n
); // #cwg39-sizeof
702 /* expected-error@#cwg39-sizeof
703 {{non-static member 'n' found in multiple base-class subobjects of type 'A':
704 struct cwg39::PR5916::D -> B -> A
705 struct cwg39::PR5916::D -> C -> A}} */
706 // expected-note@#cwg39-A-n {{member found by ambiguous name lookup}}
708 // expected-error@#cwg39-sizeof {{unknown type name}}
709 #if __cplusplus >= 201103L
712 {{non-static member 'n' found in multiple base-class subobjects of type 'A':
713 struct cwg39::PR5916::D -> B -> A
714 struct cwg39::PR5916::D -> C -> A}} */
715 // expected-note@#cwg39-A-n {{member found by ambiguous name lookup}}
722 namespace cwg41
{ // cwg41: yes
726 namespace cwg42
{ // cwg42: yes
727 struct A
{ static const int k
= 0; };
728 struct B
: A
{ static const int k
= A::k
; };
733 namespace cwg44
{ // cwg44: sup 727
735 template<int> void f();
736 template<> void f
<0>();
740 namespace cwg45
{ // cwg45: yes
748 namespace cwg46
{ // cwg46: yes
749 template<typename
> struct A
{ template<typename
> struct B
{}; };
750 template template struct A
<int>::B
<int>;
751 // expected-error@-1 {{expected unqualified-id}}
754 namespace cwg47
{ // cwg47: sup 329
755 template<typename T
> struct A
{
756 friend void f() { T t
; } // #cwg47-f
757 // expected-error@-1 {{redefinition of 'f'}}
758 // expected-note@#cwg47-b {{in instantiation of template class 'cwg47::A<float>' requested here}}
759 // expected-note@#cwg47-f {{previous definition is here}}
762 A
<float> b
; // #cwg47-b
768 namespace cwg48
{ // cwg48: yes
771 static const int m
= 0;
772 static const int n
= 0;
773 static const int o
= 0;
777 // FIXME: We should produce a 'has internal linkage but is not defined'
778 // diagnostic for 'S::n'.
784 namespace cwg49
{ // cwg49: 2.8
785 template<int*> struct A
{}; // #cwg49-A
787 #if __has_feature(cxx_constexpr)
790 int *const p
= &k
; // #cwg49-p
793 // cxx98-error@#cwg49-b {{non-type template argument referring to object 'p' with internal linkage is a C++11 extension}}
794 // cxx98-note@#cwg49-p {{non-type template argument refers to object here}}
795 // cxx98-14-error@#cwg49-b {{non-type template argument for template parameter of pointer type 'int *' must have its address taken}}
796 // cxx98-14-note@#cwg49-A {{template parameter is declared here}}
797 int *q
= &k
; // #cwg49-q
799 // cxx98-error@#cwg49-c {{non-type template argument for template parameter of pointer type 'int *' must have its address taken}}
800 // cxx98-note@#cwg49-A {{template parameter is declared here}}
801 // cxx11-14-error@#cwg49-c {{non-type template argument of type 'int *' is not a constant expression}}
802 // cxx11-14-note@#cwg49-c {{read of non-constexpr variable 'q' is not allowed in a constant expression}}
803 // cxx11-14-note@#cwg49-q {{declared here}}
804 // cxx11-14-note@#cwg49-A {{template parameter is declared here}}
805 // since-cxx17-error@#cwg49-c {{non-type template argument is not a constant expression}}
806 // since-cxx17-note@#cwg49-c {{read of non-constexpr variable 'q' is not allowed in a constant expression}}
807 // since-cxx17-note@#cwg49-q {{declared here}}
810 namespace cwg50
{ // cwg50: yes
811 struct X
; // #cwg50-X
814 X
*r
= static_cast<X
*>(p
);
815 X
*s
= const_cast<X
*>(p
);
816 X
*t
= reinterpret_cast<X
*>(p
);
817 X
*u
= dynamic_cast<X
*>(p
);
818 // expected-error@-1 {{'cwg50::X' is an incomplete type}}
819 // expected-note@#cwg50-X {{forward declaration of 'cwg50::X'}}
822 namespace cwg51
{ // cwg51: 2.8
832 namespace cwg52
{ // cwg52: 2.8
833 struct A
{ int n
; }; // #cwg52-A
834 struct B
: private A
{} b
; // #cwg52-B
835 int k
= b
.A::n
; // #cwg52-k
836 // FIXME: This first diagnostic is very strangely worded, and seems to be bogus.
837 // expected-error@#cwg52-k {{'A' is a private member of 'cwg52::A'}}
838 // expected-note@#cwg52-B {{constrained by private inheritance here}}
839 // expected-note@#cwg52-A {{member is declared here}}
840 // expected-error@#cwg52-k {{cannot cast 'struct B' to its private base class 'cwg52::A'}}
841 // expected-note@#cwg52-B {{declared private here}}
844 namespace cwg53
{ // cwg53: yes
846 enum E
{ e
} x
= static_cast<E
>(n
);
849 namespace cwg54
{ // cwg54: 2.8
850 struct A
{ int a
; } a
;
851 struct V
{ int v
; } v
;
852 struct B
: private A
, virtual V
{ int b
; } b
; // #cwg54-B
854 A
&sab
= static_cast<A
&>(b
);
855 // expected-error@-1 {{cannot cast 'struct B' to its private base class 'A'}}
856 // expected-note@#cwg54-B {{declared private here}}
857 A
*spab
= static_cast<A
*>(&b
);
858 // expected-error@-1 {{cannot cast 'struct B' to its private base class 'A'}}
859 // expected-note@#cwg54-B {{declared private here}}
860 int A::*smab
= static_cast<int A::*>(&B::b
);
861 // expected-error@-1 {{cannot cast 'cwg54::B' to its private base class 'cwg54::A'}}
862 // expected-note@#cwg54-B {{declared private here}}
863 B
&sba
= static_cast<B
&>(a
);
864 // expected-error@-1 {{cannot cast private base class 'cwg54::A' to 'cwg54::B'}}
865 // expected-note@#cwg54-B {{declared private here}}
866 B
*spba
= static_cast<B
*>(&a
);
867 // expected-error@-1 {{cannot cast private base class 'cwg54::A' to 'cwg54::B'}}
868 // expected-note@#cwg54-B {{declared private here}}
869 int B::*smba
= static_cast<int B::*>(&A::a
);
870 // expected-error@-1 {{cannot cast private base class 'cwg54::A' to 'cwg54::B'}}
871 // expected-note@#cwg54-B {{declared private here}}
873 V
&svb
= static_cast<V
&>(b
);
874 V
*spvb
= static_cast<V
*>(&b
);
875 int V::*smvb
= static_cast<int V::*>(&B::b
);
876 // expected-error@-1 {{conversion from pointer to member of class 'cwg54::B' to pointer to member of class 'cwg54::V' via virtual base 'cwg54::V' is not allowed}}
877 B
&sbv
= static_cast<B
&>(v
);
878 // expected-error@-1 {{cannot cast 'struct V' to 'B &' via virtual base 'cwg54::V'}}
879 B
*spbv
= static_cast<B
*>(&v
);
880 // expected-error@-1 {{cannot cast 'cwg54::V *' to 'B *' via virtual base 'cwg54::V'}}
881 int B::*smbv
= static_cast<int B::*>(&V::v
);
882 // expected-error@-1 {{conversion from pointer to member of class 'cwg54::V' to pointer to member of class 'cwg54::B' via virtual base 'cwg54::V' is not allowed}}
886 int A::*cmab
= (int A::*)(&B::b
);
889 int B::*cmba
= (int B::*)(&A::a
);
893 int V::*cmvb
= (int V::*)(&B::b
);
894 // expected-error@-1 {{conversion from pointer to member of class 'cwg54::B' to pointer to member of class 'cwg54::V' via virtual base 'cwg54::V' is not allowed}}
896 // expected-error@-1 {{cannot cast 'struct V' to 'B &' via virtual base 'cwg54::V'}}
898 // expected-error@-1 {{cannot cast 'cwg54::V *' to 'B *' via virtual base 'cwg54::V'}}
899 int B::*cmbv
= (int B::*)(&V::v
);
900 // expected-error@-1 {{conversion from pointer to member of class 'cwg54::V' to pointer to member of class 'cwg54::B' via virtual base 'cwg54::V' is not allowed}}
903 namespace cwg55
{ // cwg55: yes
905 static_assert(e
+ 1 == 6, "");
908 namespace cwg56
{ // cwg56: yes
910 typedef int T
; // #cwg56-typedef-int-T-first
912 // expected-error@-1 {{redefinition of 'T'}}
913 // expected-note@#cwg56-typedef-int-T-first {{previous definition is here}}
917 typedef X X
; // #cwg56-typedef-X-X-first
919 // expected-error@-1 {{redefinition of 'X'}}
920 // expected-note@#cwg56-typedef-X-X-first {{previous definition is here}}
924 namespace cwg58
{ // cwg58: 3.1
925 // FIXME: Ideally, we should have a CodeGen test for this.
926 #if __cplusplus >= 201103L
927 enum E1
{ E1_0
= 0, E1_1
= 1 };
928 enum E2
{ E2_0
= 0, E2_m1
= -1 };
929 struct X
{ E1 e1
: 1; E2 e2
: 1; };
930 static_assert(X
{E1_1
, E2_m1
}.e1
== 1, "");
931 static_assert(X
{E1_1
, E2_m1
}.e2
== -1, "");
935 namespace cwg59
{ // cwg59: yes
936 #pragma clang diagnostic push
937 #pragma clang diagnostic ignored "-Wdeprecated-volatile"
938 template<typename T
> struct convert_to
{ operator T() const; };
939 struct A
{}; // #cwg59-A
940 struct B
: A
{}; // #cwg59-B
942 A a1
= convert_to
<A
>();
943 A a2
= convert_to
<A
&>();
944 A a3
= convert_to
<const A
>();
945 A a4
= convert_to
<const volatile A
>();
946 // cxx98-14-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::A'}}
947 // cxx98-14-note@#cwg59-A {{candidate constructor (the implicit copy constructor) not viable: 1st argument ('const volatile cwg59::A') would lose volatile qualifier}}
948 // cxx11-14-note@#cwg59-A {{candidate constructor (the implicit move constructor) not viable: 1st argument ('const volatile cwg59::A') would lose const and volatile qualifiers}}
949 // cxx98-14-note@#cwg59-A {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
950 A a5
= convert_to
<const volatile A
&>();
951 // expected-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::A'}}
952 // expected-note@#cwg59-A {{candidate constructor (the implicit copy constructor) not viable: 1st argument ('const volatile cwg59::A') would lose volatile qualifier}}
953 // since-cxx11-note@#cwg59-A {{candidate constructor (the implicit move constructor) not viable: 1st argument ('const volatile cwg59::A') would lose const and volatile qualifiers}}
954 // expected-note@#cwg59-A {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
956 B b1
= convert_to
<B
>();
957 B b2
= convert_to
<B
&>();
958 B b3
= convert_to
<const B
>();
959 B b4
= convert_to
<const volatile B
>();
960 // cxx98-14-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::B'}}
961 // cxx98-14-note@#cwg59-B {{candidate constructor (the implicit copy constructor) not viable: 1st argument ('const volatile cwg59::B') would lose volatile qualifier}}
962 // cxx11-14-note@#cwg59-B {{candidate constructor (the implicit move constructor) not viable: 1st argument ('const volatile cwg59::B') would lose const and volatile qualifiers}}
963 // cxx98-14-note@#cwg59-B {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
964 B b5
= convert_to
<const volatile B
&>();
965 // expected-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::B'}}
966 // expected-note@#cwg59-B {{candidate constructor (the implicit copy constructor) not viable: 1st argument ('const volatile cwg59::B') would lose volatile qualifier}}
967 // since-cxx11-note@#cwg59-B {{candidate constructor (the implicit move constructor) not viable: 1st argument ('const volatile cwg59::B') would lose const and volatile qualifiers}}
968 // expected-note@#cwg59-B {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
970 A c1
= convert_to
<B
>();
971 A c2
= convert_to
<B
&>();
972 A c3
= convert_to
<const B
>();
973 A c4
= convert_to
<const volatile B
>();
974 // expected-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::B'}}
975 // expected-note@#cwg59-A {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const volatile cwg59::B' to 'const A &' for 1st argument}}
976 // since-cxx11-note@#cwg59-A {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'const volatile cwg59::B' to 'A &&' for 1st argument}}
977 // expected-note@#cwg59-A {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
978 A c5
= convert_to
<const volatile B
&>();
979 // expected-error@-1 {{no viable constructor copying variable of type 'const volatile cwg59::B'}}
980 // expected-note@#cwg59-A {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const volatile cwg59::B' to 'const A &' for 1st argument}}
981 // since-cxx11-note@#cwg59-A {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'const volatile cwg59::B' to 'A &&' for 1st argument}}
982 // expected-note@#cwg59-A {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
984 int n1
= convert_to
<int>();
985 int n2
= convert_to
<int&>();
986 int n3
= convert_to
<const int>();
987 int n4
= convert_to
<const volatile int>();
988 int n5
= convert_to
<const volatile int&>();
989 #pragma clang diagnostic pop
992 namespace cwg60
{ // cwg60: yes
999 namespace cwg61
{ // cwg61: 3.4
1007 // This is (presumably) valid, because x.f does not refer to an overloaded
1011 // expected-error@-1 {{cannot create a non-constant pointer to member function}}
1013 // expected-error@-1 {{cannot create a non-constant pointer to member function}}
1016 namespace cwg62
{ // cwg62: 2.9
1018 struct { int n
; } b
;
1020 template<typename T
> struct X
{};
1021 template<typename T
> T
get() { return get
<T
>(); }
1022 template<typename T
> int take(T
) { return 0; }
1027 typedef struct { } *NoNameForLinkagePtr
; // #cwg62-unnamed
1028 NoNameForLinkagePtr noNameForLinkagePtr
;
1031 NoNameForLinkagePtr p
;
1034 X
<NoNameForLinkagePtr
> x2
;
1035 // cxx98-error@-1 {{template argument uses unnamed type}}
1036 // cxx98-note@#cwg62-unnamed {{unnamed type used in template argument was declared here}}
1037 X
<const NoNameForLinkagePtr
> x3
;
1038 // cxx98-error@-1 {{template argument uses unnamed type}}
1039 // cxx98-note@#cwg62-unnamed {{unnamed type used in template argument was declared here}}
1040 NoNameForLinkagePtr p1
= get
<NoNameForLinkagePtr
>();
1041 // cxx98-error@-1 {{template argument uses unnamed type}}
1042 // cxx98-note@#cwg62-unnamed {{unnamed type used in template argument was declared here}}
1043 NoNameForLinkagePtr p2
= get
<const NoNameForLinkagePtr
>();
1044 // cxx98-error@-1 {{template argument uses unnamed type}}
1045 // cxx98-note@#cwg62-unnamed {{unnamed type used in template argument was declared here}}
1046 int n1
= take(noNameForLinkagePtr
);
1047 // cxx98-error@-1 {{template argument uses unnamed type}}
1048 // cxx98-note@#cwg62-unnamed {{unnamed type used in template argument was declared here}}
1053 struct NoLinkage
{};
1055 // cxx98-error@-1 {{template argument uses local type }}
1056 X
<const NoLinkage
> b
;
1057 // cxx98-error@-1 {{template argument uses local type }}
1059 // cxx98-error@-1 {{template argument uses local type }}
1060 get
<const NoLinkage
>();
1061 // cxx98-error@-1 {{template argument uses local type }}
1062 X
<void (*)(NoLinkage
A::*)> c
;
1063 // cxx98-error@-1 {{template argument uses local type }}
1064 X
<int NoLinkage::*> d
;
1065 // cxx98-error@-1 {{template argument uses local type }}
1069 namespace cwg63
{ // cwg63: yes
1070 template<typename T
> struct S
{ typename
T::error e
; };
1075 namespace cwg64
{ // cwg64: yes
1076 template<class T
> void f(T
);
1077 template<class T
> void f(T
*);
1078 template<> void f(int*);
1079 template<> void f
<int>(int*);
1080 template<> void f(int);
1085 namespace cwg66
{ // cwg66: no
1087 int f(int n
); // #cwg66-f-first
1094 // FIXME: The first two calls here should be accepted.
1096 // expected-error@-1 {{no matching function for call to 'f'}}
1097 // expected-note@#cwg66-f-first {{candidate function not viable: requires single argument 'n', but no arguments were provided}}
1100 // expected-error@-1 {{no matching function for call to 'f'}}
1101 // expected-note@#cwg66-f-first {{candidate function not viable: requires single argument 'n', but 2 arguments were provided}}
1106 namespace cwg68
{ // cwg68: 2.8
1107 template<typename T
> struct X
{};
1108 struct ::cwg68::X
<int> x1
;
1109 struct ::cwg68::template X
<int> x2
;
1110 // cxx98-error@-1 {{'template' keyword outside of a template}}
1112 friend struct X
<int>;
1113 friend struct ::cwg68::X
<char>;
1114 friend struct ::cwg68::template X
<double>;
1115 // cxx98-error@-1 {{'template' keyword outside of a template}}
1119 friend struct ::cwg68::template X
<double>;
1120 friend typename ::cwg68::X
<double>;
1121 // cxx98-error@-1 {{unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'typename ::cwg68::X<double>'}}
1125 namespace cwg69
{ // cwg69: 9
1126 template<typename T
> static void f() {} // #cwg69-f
1127 // FIXME: Should we warn here?
1128 inline void g() { f
<int>(); }
1129 extern template void f
<char>();
1130 // cxx98-error@-1 {{extern templates are a C++11 extension}}
1131 // expected-error@-2 {{explicit instantiation declaration of 'f' with internal linkage}}
1132 template<void(*)()> struct Q
{};
1134 // cxx98-error@-1 {{non-type template argument referring to function 'f<int>' with internal linkage is a C++11 extension}}
1135 // cxx98-note@#cwg69-f {{non-type template argument refers to function here}}
1138 namespace cwg70
{ // cwg70: yes
1139 template<int> struct A
{};
1140 template<int I
, int J
> int f(int (&)[I
+ J
], A
<I
>, A
<J
>);
1142 int k
= f(arr
, A
<3>(), A
<4>());
1148 #if __cplusplus >= 201103L
1149 namespace cwg73
{ // cwg73: sup 1652
1151 static_assert(&a
+ 1 != &b
, "");
1152 // expected-error@-1 {{static assertion expression is not an integral constant expression}}
1153 // expected-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}}
1157 namespace cwg74
{ // cwg74: yes
1159 int (*p
)[k
] = new int[k
][k
];
1162 namespace cwg75
{ // cwg75: yes
1165 // expected-error@-1 {{non-const static data member must be initialized out of line}}
1169 namespace cwg76
{ // cwg76: yes
1170 const volatile int n
= 1;
1171 static_assert(n
, "");
1172 // expected-error@-1 {{static assertion expression is not an integral constant expression}}
1173 // expected-note@-2 {{read of volatile-qualified type 'const volatile int' is not allowed in a constant expression}}
1176 namespace cwg77
{ // cwg77: yes
1183 namespace cwg78
{ // cwg78: sup ????
1184 // Under CWG78, this is valid, because 'k' has static storage duration, so is
1185 // zero-initialized.
1187 // expected-error@-1 {{default initialization of an object of const type 'const int'}}
1192 namespace cwg80
{ // cwg80: 2.9
1198 // expected-error@-1 {{member 'B' has the same name as its class}}
1202 // expected-error@-1 {{member 'C' has the same name as its class}}
1208 // expected-error@-1 {{member 'D' has the same name as its class}}
1215 namespace cwg83
{ // cwg83: yes
1216 int &f(const char*);
1221 namespace cwg84
{ // cwg84: yes
1223 struct A
{ operator B() const; };
1226 B(B
&); // #cwg84-copy-ctor
1227 B(C
); // #cwg84-ctor-from-C
1231 // Cannot use B(C) / operator C() pair to construct the B from the B temporary
1232 // here. In C++17, we initialize the B object directly using 'A::operator B()'.
1234 // cxx98-14-error@-1 {{no viable constructor copying variable of type 'B'}}
1235 // cxx98-14-note@#cwg84-copy-ctor {{candidate constructor not viable: expects an lvalue for 1st argument}}
1236 // cxx98-14-note@#cwg84-ctor-from-C {{candidate constructor not viable: no known conversion from 'B' to 'C' for 1st argument}}
1239 namespace cwg85
{ // cwg85: 3.4
1242 struct B
{}; // #cwg85-B-def
1244 // expected-error@-1 {{class member cannot be redeclared}}
1245 // expected-note@#cwg85-B-def {{previous declaration is here}}
1248 union U
{}; // #cwg85-U-def
1250 // expected-error@-1 {{class member cannot be redeclared}}
1251 // expected-note@#cwg85-U-def {{previous declaration is here}}
1253 #if __cplusplus >= 201103L
1255 enum E1
: int { e1
}; // #cwg85-E1-def
1257 // expected-error@-1 {{class member cannot be redeclared}}
1258 // expected-note@#cwg85-E1-def {{previous declaration is here}}
1261 enum class E2
{ e2
}; // #cwg85-E2-def
1263 // expected-error@-1 {{class member cannot be redeclared}}
1264 // expected-note@#cwg85-E2-def {{previous declaration is here}}
1268 template <typename T
>
1270 struct B
{}; // #cwg85-C-B-def
1272 // expected-error@-1 {{class member cannot be redeclared}}
1273 // expected-note@#cwg85-C-B-def {{previous declaration is here}}
1279 namespace cwg87
{ // cwg87: no
1280 // FIXME: Superseded by cwg1975
1281 template<typename T
> struct X
{};
1282 // FIXME: This is invalid.
1283 X
<void() throw()> x
;
1284 // This is valid under cwg87 but not under cwg1975.
1285 X
<void(void() throw())> y
;
1288 namespace cwg88
{ // cwg88: 2.8
1289 template<typename T
> struct S
{
1290 static const int a
= 1; // #cwg88-a
1293 template<> const int S
<int>::a
= 4;
1294 // expected-error@-1 {{static data member 'a' already has an initializer}}
1295 // expected-note@#cwg88-a {{previous initialization is here}}
1296 template<> const int S
<int>::b
= 4;
1301 namespace cwg90
{ // cwg90: yes
1303 template<typename T
> friend void cwg90_f(T
);
1306 template<typename T
> friend void cwg90_g(T
);
1317 // expected-error@-1 {{use of undeclared identifier 'cwg90_f'}}
1319 // expected-error@-1 {{use of undeclared identifier 'cwg90_f'}}
1322 // expected-error@-1 {{use of undeclared identifier 'cwg90_f'}}
1325 // expected-error@-1 {{use of undeclared identifier 'cwg90_g'}}
1331 // expected-error@-1 {{use of undeclared identifier 'cwg90_g'}}
1335 namespace cwg91
{ // cwg91: yes
1336 union U
{ friend int f(U
); };
1340 namespace cwg92
{ // cwg92: 4 c++17
1341 void f() throw(int, float);
1342 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
1343 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
1344 void (*p
)() throw(int) = &f
; // #cwg92-p
1345 // since-cxx17-error@#cwg92-p {{ISO C++17 does not allow dynamic exception specifications}}
1346 // since-cxx17-note@#cwg92-p {{use 'noexcept(false)' instead}}
1347 // cxx98-14-error@#cwg92-p {{target exception specification is not superset of source}}
1348 // since-cxx17-warning@#cwg92-p {{target exception specification is not superset of source}}
1349 void (*q
)() throw(int);
1350 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
1351 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
1352 void (**pp
)() throw() = &q
;
1353 // cxx98-14-error@-1 {{exception specifications are not allowed beyond a single level of indirection}}
1354 // since-cxx17-error@-2 {{cannot initialize a variable of type 'void (**)() throw()' with an rvalue of type 'void (**)() throw(int)'}}
1356 void g(void() throw()); // #cwg92-g
1357 // cxx98-14-warning@-1 {{mangled name of 'g' will change in C++17 due to non-throwing exception specification in function signature}}
1360 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
1361 // since-cxx17-error@-2 {{no matching function for call to 'g'}}
1362 // since-cxx17-note@#cwg92-g {{candidate function not viable: no known conversion from 'void () throw(int, float)' to 'void (*)() throw()' for 1st argument}}
1364 // cxx98-14-error@-1 {{target exception specification is not superset of source}}
1365 // since-cxx17-error@-2 {{no matching function for call to 'g'}}
1366 // since-cxx17-note@#cwg92-g {{candidate function not viable: no known conversion from 'void (*)() throw(int)' to 'void (*)() throw()' for 1st argument}}
1369 // Prior to C++17, this is OK because the exception specification is not
1370 // considered in this context. In C++17, we *do* perform an implicit
1371 // conversion (which performs initialization), and the exception specification
1372 // is part of the type of the parameter, so this is invalid.
1373 template<void() throw()> struct X
{};
1375 // since-cxx17-error@-1 {{value of type 'void (*)() throw(int, float)' is not implicitly convertible to 'void (*)() throw()'}}
1377 template<void() throw(int)> struct Y
{};
1378 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}}
1379 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}}
1385 namespace cwg94
{ // cwg94: yes
1386 struct A
{ static const int n
= 5; };
1390 namespace cwg95
{ // cwg95: 3.3
1397 static void f(); // #cwg95-C-f
1399 struct A
*p
; // cwg95::A, not cwg95::N::A.
1401 A
*q
= N::p
; // ok, same type
1402 struct B
{ void f() { N::C::f(); } };
1403 // expected-error@-1 {{'f' is a private member of 'cwg95::N::C'}}
1404 // expected-note@#cwg95-C-f {{implicitly declared private here}}
1407 namespace cwg96
{ // cwg96: sup P1787
1410 template<typename T
> int f(T
);
1411 template<typename T
> struct S
{};
1413 template<template<typename
> class X
> struct B
{};
1415 template<typename T
>
1417 int k1
= a
.template f
<int>(0);
1418 // FIXME: This is ill-formed, because 'f' is not a template-id and does not
1419 // name a class template.
1420 // FIXME: What about alias templates?
1421 int k2
= a
.template f(1);
1422 // expected-error@-1 {{a template argument list is expected after a name prefixed by the template keyword}}
1423 A::template S
<int> s
;
1428 namespace cwg97
{ // cwg97: yes
1430 static const int a
= false;
1431 static const int b
= !a
;
1435 namespace cwg98
{ // cwg98: yes
1440 // expected-error@-1 {{cannot jump from switch statement to this case label}}
1441 // expected-note@#cwg98-try {{jump bypasses initialization of try block}}
1444 } catch (...) { // #cwg98-catch
1446 // expected-error@-1 {{cannot jump from switch statement to this case label}}
1447 // expected-note@#cwg98-catch {{jump bypasses initialization of catch block}}
1453 // expected-error@-1 {{cannot jump from this goto statement to its label}}
1454 // expected-note@#cwg98-try {{jump bypasses initialization of try block}}
1457 // expected-error@-1 {{cannot jump from this goto statement to its label}}
1458 // expected-note@#cwg98-catch {{jump bypasses initialization of catch block}}
1463 namespace cwg99
{ // cwg99: sup 214
1464 template<typename T
> void f(T
&);
1465 template<typename T
> int &f(const T
&);