[temp.res.general] p5: dependent qualified-id and using-declarator
@jensmaurer is already working on this.
Since Aug 5, 2021.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
In the current draft, [basic.lookup.qual#general-2] specifies the qualified name, where it seems that it intends to use qualified-id to cover such as a simple-type-specifier that has the form nested-name-specifieropttype-name. In other words, they all can form nested-name-specifier identifier on syntax. However, they are not the same thing on grammar.
Furthermore, [temp.res#general-5] also intends to use qualified-id to cover a simple-type-specifier that may have the aforementioned form. The meaning of the qualified-id is vague in such use, consider a using-declarator, which has the form nested-name-specifier unqualified-id
using T::identifier;
Does that mean any rule that uses the qualified-id to cover the form that is not a qualified-id on grammar can also impose on the using-declarator that has the same form? It seems a defect in the current standard. This issue is also mentioned on SO.
This example would illustrate the vague
struct X{
typedef int Type;
};
template<typename T>
struct Test:T{
using T::Type; // #1
};
int main(){
Test<X> obj;
}
GCC agrees on this example while Clang reports an error. If we say the using-declarator at #1 is considered as a qualified-id, then Clang is right due to [temp.res#general-5] imposes on it.
A qualified-id whose terminal name is dependent and that is in a type-only context is considered to denote a type.
I don't think it's a good example here, I still think Clang is wrong, even if T::Type is not considered to denote a type, I didn't see any big deal at #1. This issue intends to expose that the extra given meaning to qualified-id would make its meaning be a mess in some rules that mention qualified-id.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.