Commit 3734964f by Dinar Temirbulatov Committed by Dinar Temirbulatov

Fix for c++/PR57958

From-SVN: r209721
parent 7de90a6c
2014-04-23 Dinar Temirbulatov <dtemirbulatov@gmail.com>
PR c++/57958
* semantics.c (apply_deduced_return_type): Complete non-void type
before estimating whether the type is aggregate.
2014-04-22 Marc Glisse <marc.glisse@inria.fr> 2014-04-22 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/43622 PR libstdc++/43622
......
...@@ -10650,6 +10650,8 @@ apply_deduced_return_type (tree fco, tree return_type) ...@@ -10650,6 +10650,8 @@ apply_deduced_return_type (tree fco, tree return_type)
if (!processing_template_decl) if (!processing_template_decl)
{ {
if (!VOID_TYPE_P (TREE_TYPE (result)))
complete_type_or_else (TREE_TYPE (result), NULL_TREE);
bool aggr = aggregate_value_p (result, fco); bool aggr = aggregate_value_p (result, fco);
#ifdef PCC_STATIC_STRUCT_RETURN #ifdef PCC_STATIC_STRUCT_RETURN
cfun->returns_pcc_struct = aggr; cfun->returns_pcc_struct = aggr;
......
// { dg-do run { target c++11 } }
#define assert(E) if(!(E))__builtin_abort();
int n = 0;
template <class T>
class Foo {
public:
Foo() {
n--;
}
Foo(const Foo&) {
n--;
}
~Foo() {
n++;
}
};
struct Data {};
void a()
{
Data b;
}
int main(int argc, char *argv[]) {
auto fn = [] (const Foo<Data>& x) {
return (x);
};
{
Foo<Data> a;
fn(a);
}
assert(n == 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