Commit ffaf1e05 by Jason Merrill Committed by Jason Merrill

re PR c++/35297 (Compiling error with variadic template with fixed parameter with default type.)

        PR c++/35297
        PR c++/35477
        PR c++/35784
        PR c++/36846
        PR c++/38276
        * pt.c (check_default_tmpl_args): Don't complain about
        out-of-order parameter packs in the enclosing class
        or parameter packs after default args.
        (coerce_template_parms): If we have more than one
        parameter pack, don't flatten argument packs.
        (template_args_equal): Handle argument packs.
        (comp_template_args): Don't flatten argument packs.
        (check_instantiated_arg): Split out from...
        (check_instantiated_args): Here.  Handle arg packs.
        (convert_template_argument): Just check that nontype argument
        packs have the right type.

From-SVN: r143166
parent 30af0edb
2009-01-06 Jason Merrill <jason@redhat.com>
PR c++/35297
PR c++/35477
PR c++/35784
PR c++/36846
PR c++/38276
* pt.c (check_default_tmpl_args): Don't complain about
out-of-order parameter packs in the enclosing class
or parameter packs after default args.
(coerce_template_parms): If we have more than one
parameter pack, don't flatten argument packs.
(template_args_equal): Handle argument packs.
(comp_template_args): Don't flatten argument packs.
(check_instantiated_arg): Split out from...
(check_instantiated_args): Here. Handle arg packs.
(convert_template_argument): Just check that nontype argument
packs have the right type.
2009-01-05 Dodji Seketeli <dodji@redhat.com>
PR c++/38472
......
2009-01-07 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/variadic92.C: New test.
* g++.dg/cpp0x/variadic93.C: New test.
2009-01-07 Janis Johnson <janis187@us.ibm.com>
* lib/target-supports-dg.exp (current_compiler_flags): New.
......
......@@ -5,4 +5,4 @@ template<typename T1 = unused, typename T2 = unused, typename T3 = unused,
struct tuple {};
template<typename... Args>
void foo(tuple<Args...>) { } // { dg-error "cannot expand" }
void foo(tuple<Args...>) { } // { dg-bogus "cannot expand" "" { xfail *-*-* } }
......@@ -3,9 +3,9 @@
template<typename> struct A;
template<typename... T> struct A<T*...> // { dg-error "cannot expand" }
template<typename... T> struct A<T*...> // { dg-bogus "cannot expand" "" { xfail *-*-* } }
{
struct B;
};
A<void*> a; // { dg-error "incomplete type" }
A<void*> a; // { dg-bogus "incomplete type" "" { xfail *-*-* } }
......@@ -3,6 +3,6 @@
template<typename> struct A;
template<typename... T> struct A<T...> { }; // { dg-error "cannot expand" }
template<typename... T> struct A<T...> { }; // { dg-bogus "cannot expand" "" { xfail *-*-* } }
A<int> a; // { dg-error "incomplete type" }
A<int> a; // { dg-bogus "incomplete type" "" { xfail *-*-* } }
// Various tests for variadic templates and partial specialization.
// { dg-options "-std=c++0x" }
// PR c++/36846
template<typename A, typename B>
struct pair;
template<typename... T>
struct pairs;
template<typename... AS, typename... BS>
struct pairs<pair<AS, BS>...> {
struct mismatched_packs {};
};
template class pairs<
pair<int, int>,
pair<int, int>
>;
template<int A, int B>
struct point;
template<typename... T>
struct points;
template<int... AS, int... BS>
struct points<point<AS, BS>...> {
struct mismatched_packs {};
};
template class points<
point<0, 1>,
point<0, 1>
>;
// PR c++/35477
template <class...ARGS> struct tuple {};
template <class A, class B> struct test {};
template <class... ARGS, class B> struct test<B, tuple<ARGS...>>
{
template <class T> struct inside {};
};
// PR c++/38276
template<typename...> struct A;
template<typename, typename> struct B;
template<typename... T, typename... U> struct B<A<T...>, A<U...> >
{
static int i;
};
B<A<>, A<int> > b1;
B<A<int>, A<> > b2;
// PR c++/35784
template <typename...> struct p;
template <typename, typename> struct d;
template <typename... A, typename... B>
struct d<p<A...>, p<B...> > { typedef int t; };
typedef d<p<>, p<int, float> >::t q;
typedef d<q, d<p<int>, p<float> >::t> r; // *
typedef d<d<p<>, p<int, float> >::t, d<p<>, p<> >::t> s;
// PR c++/35297
// { dg-options "-std=c++0x" }
template <class T=int, class... ARGS>
struct test2 {};
int main()
{
test2<> a;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment