Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Implement P0195R2, C++17 variadic using.
* parser.c (cp_parser_using_declaration): Handle ellipsis and comma. * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE. * error.c (dump_decl): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244246 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
Showing
with
119 additions
and 13 deletions.
- +7 −0 gcc/cp/ChangeLog
- +2 −1 gcc/cp/cp-tree.def
- +15 −4 gcc/cp/error.c
- +23 −1 gcc/cp/parser.c
- +33 −7 gcc/cp/pt.c
- +19 −0 gcc/testsuite/g++.dg/cpp1z/using2.C
- +20 −0 gcc/testsuite/g++.dg/cpp1z/using3.C
@@ -0,0 +1,19 @@ | ||
// Test for P0195R2 variadic using. | ||
// { dg-do compile { target c++11 } } | ||
// { dg-options "" } | ||
|
||
struct A { void f(); }; | ||
struct B { void f(int); }; | ||
|
||
template <class... Bases> struct C: Bases... | ||
{ | ||
using Bases::f...; // { dg-warning "pack expansion" "" { target c++14_down } } | ||
}; | ||
|
||
int main() | ||
{ | ||
C<A,B> c; | ||
c.f(); | ||
c.f(42); | ||
} | ||
|
@@ -0,0 +1,20 @@ | ||
// Test for P0195R2 multiple using. | ||
// { dg-options "" } | ||
|
||
namespace A { | ||
int i; | ||
} | ||
|
||
namespace A1 { | ||
using A::i, A::i; // OK: double declaration | ||
// { dg-warning "comma" "" { target c++14_down } .-1 } | ||
} | ||
|
||
struct B { | ||
int i; | ||
}; | ||
|
||
struct X : B { | ||
using B::i, B::i; // { dg-error "redeclaration" } | ||
// { dg-warning "comma" "" { target c++14_down } .-1 } | ||
}; |