Commit 4ed024b6 by Jason Merrill Committed by Jason Merrill

re PR c++/57196 (Bogus "aggregate ... has incomplete type and cannot be defined")

	PR c++/57196
	* pt.c (convert_template_argument): Use dependent_template_arg_p,
	not uses_template_parms.

From-SVN: r198778
parent 616eece3
2013-05-10 Jason Merrill <jason@redhat.com>
PR c++/57196
* pt.c (convert_template_argument): Use dependent_template_arg_p,
not uses_template_parms.
PR c++/57047
* semantics.c (cxx_fold_indirect_ref): Fix thinko.
......
......@@ -6368,7 +6368,8 @@ convert_template_argument (tree parm,
val = error_mark_node;
}
}
else if (!uses_template_parms (orig_arg) && !uses_template_parms (t))
else if (!dependent_template_arg_p (orig_arg)
&& !uses_template_parms (t))
/* We used to call digest_init here. However, digest_init
will report errors, which we don't want when complain
is zero. More importantly, digest_init will try too
......
// PR c++/57196
// { dg-require-effective-target c++11 }
#include <initializer_list>
template<class T>
struct set {
set() = default;
set(std::initializer_list<T>){}
};
struct string {
string(const char*){}
~string(){}
};
typedef decltype(sizeof(0)) size_t;
template <size_t> struct EqHelper { };
int IsNullLiteralHelper(...);
void Fn() {
EqHelper<sizeof IsNullLiteralHelper(set<int>{1})> eq1; // ok
EqHelper<sizeof IsNullLiteralHelper(set<string>())> eq2; // ok
EqHelper<sizeof IsNullLiteralHelper(set<string>{"foo"})> eq3; // error
}
......@@ -10,3 +10,5 @@ struct A
template<T N = 0, void (A::*)() = &A::foo<N> > struct B {}; // { dg-error "type|declared" }
B<> b; // { dg-error "type|declaration" }
// { dg-prune-output "could not convert" }
......@@ -5,7 +5,7 @@ struct A
template<typename> void foo() {}
};
template<void (A::*)()> struct B {}; // { dg-error "declaration" }
template<void (A::*)()> struct B {};
template<int> struct C
{
......@@ -13,3 +13,5 @@ template<int> struct C
};
C<0> c;
// { dg-prune-output "could not convert" }
......@@ -9,3 +9,5 @@ struct A
template<int N, void (A::*)() = &A::foo<N> > struct B {};
B<int> b; // { dg-error "type/value mismatch|expected a constant|invalid type" }
// { dg-prune-output "could not convert" }
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