diff options
author | fabien <fabien@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-02 19:58:06 +0000 |
---|---|---|
committer | fabien <fabien@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-02 19:58:06 +0000 |
commit | 1129c81996e64b74b801507821c31ed9129086d8 (patch) | |
tree | 8fec9e0051d93a23c33a7add6efb3d2cacf3f324 /gcc/cp/name-lookup.c | |
parent | ac66ebf1eafd4746383a8288b531305e4f8aef14 (diff) | |
download | gcc-1129c81996e64b74b801507821c31ed9129086d8.tar.gz |
2014-02-02 Fabien Chene <fabien@gcc.gnu.org>
PR c++/37140
* parser.c (cp_parser_nonclass_name): Call strip_using_decl and
move the code handling dependent USING_DECLs...
* name-lookup.c (strip_using_decl): ...Here.
2014-02-02 Fabien Chene <fabien@gcc.gnu.org>
PR c++/37140
* g++.dg/template/using27.C: New.
* g++.dg/template/using28.C: New.
* g++.dg/template/using29.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207407 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 3ffcf6971fa..ea16061f2ae 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -406,7 +406,8 @@ pop_bindings_and_leave_scope (void) leave_scope (); } -/* Strip non dependent using declarations. */ +/* Strip non dependent using declarations. If DECL is dependent, + surreptitiously create a typename_type and return it. */ tree strip_using_decl (tree decl) @@ -416,6 +417,23 @@ strip_using_decl (tree decl) while (TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl)) decl = USING_DECL_DECLS (decl); + + if (TREE_CODE (decl) == USING_DECL && DECL_DEPENDENT_P (decl) + && USING_DECL_TYPENAME_P (decl)) + { + /* We have found a type introduced by a using + declaration at class scope that refers to a dependent + type. + + using typename :: [opt] nested-name-specifier unqualified-id ; + */ + decl = make_typename_type (TREE_TYPE (decl), + DECL_NAME (decl), + typename_type, tf_error); + if (decl != error_mark_node) + decl = TYPE_NAME (decl); + } + return decl; } |