[clang] [Clang] Implement resolution for CWG1835 (PR #92957)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Wed May 22 04:54:58 PDT 2024
================
@@ -55,15 +55,21 @@ namespace PR11856 {
template<typename T> T *end(T*);
- class X { };
+ struct X { };
+ struct Y {
+ int end;
+ };
template <typename T>
void Foo2() {
T it1;
- if (it1->end < it1->end) {
- }
+ if (it1->end < it1->end) { }
X *x;
- if (x->end < 7) { // expected-error{{no member named 'end' in 'PR11856::X'}}
- }
+ if (x->end < 7) { } // expected-error{{expected '>'}}
+ // expected-note at -1{{to match this '<'}}
+ // expected-error at -2{{expected unqualified-id}}
----------------
sdkrystian wrote:
This actually is expected -- see the final note in the comments of the PR. Since we didn't find anything via qualified lookup, we "lock into" the nested-name-specifier interpretation (because it would otherwise be an invalid class member access since such a member doesn't exist). So, we do unqualified lookup, find the template, and try parse `<` as a template argument list.
https://github.com/llvm/llvm-project/pull/92957
More information about the cfe-commits
mailing list