Skip to content

Commit 0a2d3e0

Browse files
committed
Address feedback and implement minor improvements
1 parent 467c478 commit 0a2d3e0

File tree

1 file changed

+41
-18
lines changed

1 file changed

+41
-18
lines changed

clang/test/CXX/drs/cwg18xx.cpp

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -642,46 +642,69 @@ namespace H {
642642
}
643643

644644
namespace cwg1898 { // cwg1898: 2.7
645-
void e(int) {} // #cwg1898-e-int
645+
void e(int) {} // #cwg1898-e
646646
void e(int) {}
647647
// expected-error@-1 {{redefinition of 'e'}}
648-
// expected-note@#cwg1898-e-int {{previous definition is here}}
649-
void e(long) {}
648+
// expected-note@#cwg1898-e {{previous definition is here}}
650649

651-
void f(int) {} // #cwg1898-f-int
650+
void e2(int) {}
651+
void e2(long) {} // OK, different type
652+
653+
void f(int) {} // #cwg1898-f
652654
void f(const int) {}
653655
// expected-error@-1 {{redefinition of 'f'}}
654-
// expected-note@#cwg1898-f-int {{previous definition is here}}
656+
// expected-note@#cwg1898-f {{previous definition is here}}
655657

656-
void g(int) {} // #cwg1898-g-int
658+
void g(int) {} // #cwg1898-g
657659
void g(volatile int) {}
658660
// since-cxx20-warning@-1 {{volatile-qualified parameter type 'volatile int' is deprecated}}
659661
// expected-error@-2 {{redefinition of 'g'}}
660-
// expected-note@#cwg1898-g-int {{previous definition is here}}
662+
// expected-note@#cwg1898-g {{previous definition is here}}
661663

662-
void h(int *) {} // #cwg1898-h-int
664+
void h(int *) {} // #cwg1898-h
663665
void h(int[]) {}
664666
// expected-error@-1 {{redefinition of 'h'}}
665-
// expected-note@#cwg1898-h-int {{previous definition is here}}
667+
// expected-note@#cwg1898-h {{previous definition is here}}
668+
669+
void h2(int *) {} // #cwg1898-h2
670+
void h2(int[2]) {}
671+
// expected-error@-1 {{redefinition of 'h2'}}
672+
// expected-note@#cwg1898-h2 {{previous definition is here}}
673+
674+
void h3(int (*)[2]) {} // #cwg1898-h3
675+
void h3(int [3][2]) {}
676+
// expected-error@-1 {{redefinition of 'h3'}}
677+
// expected-note@#cwg1898-h3 {{previous definition is here}}
678+
679+
void h4(int (*)[2]) {}
680+
void h4(int [3][3]) {} // OK, differ in non-top-level extent of array
666681

667-
void i(int *) {} // #cwg1898-i-int
668-
void i(int[2]) {}
669-
// expected-error@-1 {{redefinition of 'i'}}
670-
// expected-note@#cwg1898-i-int {{previous definition is here}}
682+
void i(int *) {}
683+
void i(const int *) {} // OK, pointee cv-qualification is not discarded
671684

672-
void j(void(*)()) {} // #cwg1898-j-int
685+
void i2(int *) {} // #cwg1898-i2
686+
void i2(int * const) {}
687+
// expected-error@-1 {{redefinition of 'i2'}}
688+
// expected-note@#cwg1898-i2 {{previous definition is here}}
689+
690+
void j(void(*)()) {} // #cwg1898-j
673691
void j(void()) {}
674692
// expected-error@-1 {{redefinition of 'j'}}
675-
// expected-note@#cwg1898-j-int {{previous definition is here}}
693+
// expected-note@#cwg1898-j {{previous definition is here}}
694+
695+
void j2(void(int)) {} // #cwg1898-j2
696+
void j2(void(const int)) {}
697+
// expected-error@-1 {{redefinition of 'j2'}}
698+
// expected-note@#cwg1898-j2 {{previous definition is here}}
676699

677700
struct A {
678-
void k(int) {} // #cwg1898-k-int
701+
void k(int) {} // #cwg1898-k
679702
void k(int) {}
680703
// expected-error@-1 {{class member cannot be redeclared}}
681-
// expected-note@#cwg1898-k-int {{previous definition is here}}
704+
// expected-note@#cwg1898-k {{previous definition is here}}
682705
};
683706

684707
struct B : A {
685-
void k(int) {}
708+
void k(int) {} // OK, shadows A::k
686709
};
687710
} // namespace cwg1898

0 commit comments

Comments
 (0)