-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party
Description
Please consider the following code:
template<class T>
class confused{};
template<class T>
class test
{
void foo() {
if(this->b.confused < 1);
};
struct bar
{
int confused;
} b;
};Clang rejects it by giving such considerably puzzling output:
<source>:8:32: error: expected '>'
8 | if(this->b.confused < 1);
| ^
<source>:8:29: note: to match this '<'
8 | if(this->b.confused < 1);
| ^
<source>:8:32: error: expected unqualified-id
8 | if(this->b.confused < 1);
| ^
<source>:8:33: warning: if statement has empty body [-Wempty-body]
8 | if(this->b.confused < 1);
| ^
<source>:8:33: note: put the semicolon on a separate line to silence this warning
1 warning and 2 errors generated.
Compiler returned: 1We suppose that's because the compiler has found incorrect local variable name of confused by confusing the global template class declared above with the integer member variable declared in the nested class bar inside test
Please check https://godbolt.org/z/7afqsvEvo.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party