-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Closed
Copy link
Labels
Description
| Bugzilla Link | 37556 |
| Resolution | FIXED |
| Resolved on | Aug 25, 2020 05:06 |
| Version | trunk |
| OS | Windows NT |
| CC | @DougGregor,@zmodem,@mclow,@riccibruno,@zygoloid |
| Fixed by commit(s) | 04ba185 |
Extended Description
Compiling this well-formed program with -std=c++2a:
namespace X {
inline namespace Y { int swap; }
template<class>
struct S {
friend void swap(S&, S&) {}
};
}
int main() {
X::S<int> s1, s2;
swap(s1, s2);
}
produces diagnostics (https://godbolt.org/g/ceWLxY):
<source>:6:21: error: redefinition of 'swap' as different kind of symbol
friend void swap(S&, S&) {}
^
<source>:11:15: note: in instantiation of template class 'X::S<int>' requested here
X::S<int> s1, s2;
^
<source>:2:30: note: previous definition is here
inline namespace Y { int swap; }
^
1 error generated.
Note that the program compiles successfully if S is replaced by a non-template class. Discussion on the CWG reflector verified that this program is well-formed, including Richard's statement "Oops, Clang's redeclaration check in the template instantiation case is incorrectly performing a redeclaration lookup as if for a qualified name here, rather than a redeclaration lookup for an unqualified name."
Reactions are currently unavailable