Fix for c++/PR57958
From-SVN: r209721
This commit is contained in:
parent
7de90a6c27
commit
3734964fdc
3 changed files with 47 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
PR libstdc++/43622
|
||||
|
|
|
@ -10650,6 +10650,8 @@ apply_deduced_return_type (tree fco, tree return_type)
|
|||
|
||||
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);
|
||||
#ifdef PCC_STATIC_STRUCT_RETURN
|
||||
cfun->returns_pcc_struct = aggr;
|
||||
|
|
39
gcc/testsuite/g++.dg/cpp0x/pr57958.C
Normal file
39
gcc/testsuite/g++.dg/cpp0x/pr57958.C
Normal file
|
@ -0,0 +1,39 @@
|
|||
// { 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);
|
||||
}
|
Loading…
Add table
Reference in a new issue