Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A conflict of name lookup when building with Visual Studio 2015 #505

Closed
straywarrior opened this issue May 2, 2017 · 5 comments
Closed

Comments

@straywarrior
Copy link

straywarrior commented May 2, 2017

I'm using fmt library with Visual Studio 2015 (Microsoft C/C++ Optimizing Compiler version 19.00.24215.1) and I meet some error like this:
type fmt::ArgVisitor<Impl, Result>::Arg [with Impl=Impl, Result=void] here is inaccessible detected during instantiation of class fmt::internal::ArgFormatterBase<Impl, Char> [with Impl=Impl, Char=Char].
However, the same codes can be compiled with gcc.
I trace the codes and find that in class internal::ArgFormatterBase (at format.h:1949), it uses type Arg without namespace scope qualifier internal::. However, its base class ArgVisitor has a private declaration typedef internal::Arg Arg (at format.h:1567). So the compiler finds the private Arg and thinks it's not accessible.
I read the C++ standard and do not find that whether compiler should continue searching the namespace scope after finding a name that is not accessible.
I will seed a feedback to Visual Studio to find out is it a feature/bug of the compiler but I also want to get your opinions about changing the codes related to internal::Args.

@foonathan
Copy link
Contributor

I could be wrong here, but according to the two phase lookup rules, an unqualified name in a template should not be deferred to instantiation, i.e. not look at the base class. However, MSVC has not implemented two phase lookup yet.

If replacing Arg with internal::Arg - or adding a typedef (again) - fixes the issue, I'll commit the changes.

@straywarrior
Copy link
Author

Thanks for your explanation and I'm happy to learn something new. Agree with your solution.

@foonathan
Copy link
Contributor

Please report if it works now.

@straywarrior
Copy link
Author

It works. Thanks.

@vitaut
Copy link
Contributor

vitaut commented May 6, 2017

MSVC has not implemented two phase lookup yet

LOL, really?

bjoernthiel pushed a commit to AbberiorInstruments/fmt that referenced this issue May 11, 2017
foonathan added a commit that referenced this issue Jun 8, 2017
foonathan added a commit that referenced this issue Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants