Dependent Names in Using-Declarations

Hi,there is an example from ”C++ Templates: The Complete Guide 9.3.4 “:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
template<typename T> 
class BXT { 
  public: 
    typedef T Mystery; 
    template<typename U> 
    struct Magic; 
}; 

template<typename T>
class DXTT : private BXT<T> {
public:
	using typename BXT<T>::Mystery;  //compile error:'Mystery' does not 
                                         //name a type (in GCC 4.7). WHY?
	Mystery* p;  // would be a syntax error if not for the typename
};

template<typename T> 
class DXTM : private BXT<T> { 
  public: 
    using BXT<T>::template Magic;  // ERROR: not standard 
    Magic<T>* plink;               // SYNTAX ERROR: Magic is not a 
};                                 //  known template 


Line 12 is well in MS vc environment, but it will lead a compile error using GCC4.7,why?
Last edited on
As far as i know using is only for declarations and namespaces. Not for types.

Further more I don't think it suitable for templates since it's unknown what is meant when used
I have tested code and it has been successfully compiled with GCC4.7.0. But I have used class DXTM.

Here is the tested code

http://liveworkspace.org/code/8083b242bde05563bb87a10d4b4d81ab
That bug report shows the bug as fixed.
The particular part of the code should compile
(The second half of the code - attempting to use the struct Magic should still fail though)
Topic archived. No new replies allowed.