mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-20 21:59:43 +08:00
new
From-SVN: r34361
This commit is contained in:
parent
56ce79f733
commit
87626353df
18
gcc/testsuite/g++.old-deja/g++.ext/return1.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.ext/return1.C
Normal file
@ -0,0 +1,18 @@
|
||||
// Test that the named return value extension works when passed as a reference.
|
||||
// Origin: Jason Merrill <jason@redhat.com>
|
||||
|
||||
void f (int &i)
|
||||
{
|
||||
i = 42;
|
||||
}
|
||||
|
||||
int g () return r
|
||||
{
|
||||
f (r);
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
int i = g ();
|
||||
return (i != 42);
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.other/goto3.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.other/goto3.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Testcase for various invalid gotos.
|
||||
// Origin: Jason Merrill <jason@redhat.com>
|
||||
// Build don't link:
|
||||
|
||||
void f ()
|
||||
{
|
||||
goto foo1; // ERROR - jumps
|
||||
try { foo1:; } catch (...) { } // ERROR - into try
|
||||
goto foo2; // ERROR - jumps
|
||||
try { } catch (...) { foo2:; } // ERROR - into catch
|
||||
goto foo3; // ERROR - jumps
|
||||
{ int i=2; foo3:; } // ERROR - past init
|
||||
|
||||
try { foo4:; } catch (...) { } // ERROR -
|
||||
goto foo4; // ERROR -
|
||||
try { } catch (...) { foo5:; } // ERROR -
|
||||
goto foo5; // ERROR -
|
||||
{ int i=2; foo6:; } // ERROR -
|
||||
goto foo6; // ERROR -
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.pt/infinite1.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.pt/infinite1.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Test for catching infinitely recursive instantiations.
|
||||
// Origin: Jason Merrill <jason@redhat.com>
|
||||
|
||||
template <int i> void f()
|
||||
{
|
||||
f<i+1>(); // ERROR - excessive recursion
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
f<0>(); // ERROR - starting here
|
||||
}
|
Loading…
Reference in New Issue
Block a user