-
Notifications
You must be signed in to change notification settings - Fork 13.5k
No namespace awareness of static template fields #8456
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
Comments
works: namespace F { same error: struct Bar : F::Foo {}; |
I'm pretty sure gcc is wrongly accepting this... where does the testcase come from? |
These code snippets are the short version of the problem when I compile ogre3d. Here the original problem in ogre3d 1.7.1 (http://www.ogre3d.org/): File: ogreSrc/OgreMain/include/OgreSingleton.h File: ogreSrc/Samples/DeferredShading/include/SharedData.h File: ogreSrc/Samples/DeferredShading/src/DeferredShadingDemo.cpp In my opinion this c++ code is valid. |
Clang is technically correct, per C++98 [temp.expl.spec]p2: An explicit specialization of a member function, member class or static data member of a class template shall be declared in the namespace of which the class template is a member. C++0x actually loosens this restriction to allow the code in question, so it's probably reasonable to downgrade this to an "extension warning" in C++98/03 mode. Besides, GCC doesn't diagnose it and EDG only diagnoses it in strict mode, so giving an error is rather harsh. |
When the code obeys the C++0x semantics but not the C++98/03 semantics (as the examples described here do), I've downgraded the error to a warning in Clang r113718. |
[cherry-pick stable/20230725] Revert "[ClangScanDeps] Fix cas dependency scanning test after D159064"
Extended Description
using namespace F;
struct Bar : Foo {};
template <> Bar* Foo::field = 0;
================================================================
system: Linux 2.6.32-24-generic amd64 Ubuntu 10.04
clang version 2.8 (trunk 113084)
Target: x86_64-unknown-linux-gnu
Thread model: posix
The text was updated successfully, but these errors were encountered: