diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/torture')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60315.C | 19 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60609.C | 252 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60648.C | 70 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60659.C | 58 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60746.C | 23 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/torture/pr60750.C | 21 |
6 files changed, 443 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60315.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60315.C new file mode 100644 index 000000000..05575c463 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60315.C @@ -0,0 +1,19 @@ +// PR ipa/60315 +// { dg-do compile } +// { dg-options "-std=c++11" } + +struct Base { + virtual int f() = 0; +}; + +struct Derived : public Base { + virtual int f() final override { + return 42; + } +}; + +extern Base* b; + +int main() { + return (static_cast<Derived*>(b)->*(&Derived::f))(); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60609.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60609.C new file mode 100644 index 000000000..9ddec0b60 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60609.C @@ -0,0 +1,252 @@ +/* { dg-do assemble } */ + +class exception +{ +}; +class bad_alloc:exception +{ +}; +class logic_error:exception +{ +}; +class domain_error:logic_error +{ +}; +class invalid_argument:logic_error +{ +}; +class length_error:logic_error +{ +}; +class overflow_error:exception +{ +}; +typedef int mpz_t[]; +template < class > class __gmp_expr; +template <> class __gmp_expr < mpz_t > +{ + ~__gmp_expr (); +}; + +class PIP_Solution_Node; +class internal_exception +{ + ~internal_exception (); +}; +class not_an_integer:internal_exception +{ +}; +class not_a_variable:internal_exception +{ +}; +class not_an_optimization_mode:internal_exception +{ +}; +class not_a_bounded_integer_type_width:internal_exception +{ +}; +class not_a_bounded_integer_type_representation:internal_exception +{ +}; +class not_a_bounded_integer_type_overflow:internal_exception +{ +}; +class not_a_complexity_class:internal_exception +{ +}; +class not_a_control_parameter_name:internal_exception +{ +}; +class not_a_control_parameter_value:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_name:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_value:internal_exception +{ +}; +class not_a_relation:internal_exception +{ +}; +class ppl_handle_mismatch:internal_exception +{ +}; +class timeout_exception +{ + ~timeout_exception (); +}; +class deterministic_timeout_exception:timeout_exception +{ +}; +void __assert_fail (const char *, const char *, int, int *) +__attribute__ ((__noreturn__)); +void PL_get_pointer (void *); +int Prolog_is_address (); +inline int +Prolog_get_address (void **p1) +{ + Prolog_is_address ()? static_cast < + void >(0) : __assert_fail ("Prolog_is_address", "./swi_cfli.hh", 0, 0); + PL_get_pointer (p1); + return 0; +} + +class non_linear:internal_exception +{ +}; +class not_unsigned_integer:internal_exception +{ +}; +class not_universe_or_empty:internal_exception +{ +}; +class not_a_nil_terminated_list:internal_exception +{ +}; +class PPL_integer_out_of_range +{ + __gmp_expr < mpz_t > n; +}; +void handle_exception (); +template < typename T > T * term_to_handle (int, const char *) +{ + if (Prolog_is_address ()) + { + void *p; + Prolog_get_address (&p); + return static_cast < T * >(0); + } + throw; +} + +void +ppl_new_MIP_Problem_from_MIP_Problem () +try +{ + term_to_handle < int >(0, "ppl_new_MIP_Problem_from_MIP_Problem/2"); +} + +catch (exception &) +{ +} + +int +ppl_PIP_Tree_Node_parametric_values () +{ + try + { + PIP_Solution_Node *a = term_to_handle < PIP_Solution_Node > (0, 0); + (void)a; + return 1; + } + catch (internal_exception &) + { + } + catch (not_unsigned_integer &) + { + handle_exception (); + } + catch (non_linear &) + { + handle_exception (); + } + catch (not_a_variable &) + { + handle_exception (); + } + catch (not_an_integer &) + { + handle_exception (); + } + catch (ppl_handle_mismatch &) + { + handle_exception (); + } + catch (not_an_optimization_mode &) + { + handle_exception (); + } + catch (not_a_complexity_class &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_width &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_representation &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_overflow &) + { + handle_exception (); + } + catch (not_a_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_control_parameter_value &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_value &) + { + handle_exception (); + } + catch (not_universe_or_empty &) + { + handle_exception (); + } + catch (not_a_relation &) + { + handle_exception (); + } + catch (not_a_nil_terminated_list &) + { + handle_exception (); + } + catch (PPL_integer_out_of_range &) + { + handle_exception (); + } + catch (int &) + { + } catch (timeout_exception &) + { + handle_exception (); + } catch (deterministic_timeout_exception &) + { + handle_exception (); + } catch (overflow_error &) + { + handle_exception (); + } catch (domain_error &) + { + handle_exception (); + } catch (length_error &) + { + handle_exception (); + } catch (invalid_argument &) + { + handle_exception (); + } catch (logic_error &) + { + handle_exception (); + } catch (bad_alloc &) + { + handle_exception (); + } catch (exception &) + { + handle_exception (); + } catch ( ...) + { + handle_exception (); + } + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60648.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60648.C new file mode 100644 index 000000000..48cf0afb5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60648.C @@ -0,0 +1,70 @@ +// PR target/60648 +// { dg-do compile } +// { dg-additional-options "-fPIC" { target fpic } } + +enum component +{ + Ex, + Ez, + Hy, + Permeability +}; +enum derived_component +{}; +enum direction +{ + X, + Y, + Z, + R, + P, + NO_DIRECTION +}; +derived_component a; +component *b; +component c; +direction d; +inline direction fn1 (component p1) +{ + switch (p1) + { + case 0: + return Y; + case 1: + return Z; + case Permeability: + return NO_DIRECTION; + } + return X; +} + +inline component fn2 (direction p1) +{ + switch (p1) + { + case 0: + case 1: + return component (); + case Z: + case R: + return component (1); + case P: + return component (3); + } +} + +void fn3 () +{ + direction e; + switch (0) + case 0: + switch (a) + { + case 0: + c = Ex; + b[1] = Hy; + } + e = fn1 (b[1]); + b[1] = fn2 (e); + d = fn1 (c); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60659.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60659.C new file mode 100644 index 000000000..f0158a522 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60659.C @@ -0,0 +1,58 @@ +// { dg-do compile } +template <typename _InputIterator> void __distance (_InputIterator); +template <typename _InputIterator> +void distance (_InputIterator, _InputIterator p2) +{ + __distance (p2); +} + +namespace boost +{ +template <class Iterator> struct A +{ + typedef typename Iterator::difference_type type; +}; +template <class T> typename T::const_iterator end (T &); +template <class T> typename T::const_iterator begin (T &); +template <class T> struct D : A<typename T::const_iterator> +{ +}; +template <class T> typename D<T>::type distance (const T &p1) +{ + distance (boost::begin (p1), boost::end (p1)); + return 0; +} +template <class IteratorT> class B +{ +public: + typedef B type; + typedef IteratorT const_iterator; +}; +} + +typedef int storage_t[]; +struct F; +template <template <typename> class> struct G +{ + G (const G &p1) { p1.m_fn1 ().m_fn1 (0); } + const F &m_fn1 () const + { + const void *a; + a = &data_m; + return *static_cast<const F *>(a); + } + storage_t *data_m; +}; + +struct F +{ + virtual F *m_fn1 (void *) const; +}; +template <typename> struct H; +struct C : G<H> +{ + typedef int difference_type; +}; +boost::B<C> AllTransVideos (); +int b = boost::distance (AllTransVideos ()); + diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60746.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60746.C new file mode 100644 index 000000000..7ce6ebe6b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60746.C @@ -0,0 +1,23 @@ +// { dg-do compile } + +class One +{ +public: + virtual unsigned long getSize () const; +}; + +class Two +{ + virtual int run (); +}; + +int +Two::run () +{ + One list_arry[5][2]; + int orig = 0; + if (list_arry[3][orig].getSize () > 0 + || list_arry[4][orig].getSize () > 0) + { + } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60750.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60750.C new file mode 100644 index 000000000..a344bd764 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60750.C @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-std=c++11" } + +#include <string> +#include <stdexcept> + +const std::string err_prefix = "Problem: "; +void thrower (std::string msg) +{ + throw std::runtime_error(err_prefix + std::move(msg)); +} + +int main(int argc, char **argv) +{ + try { + std::string base = "hello"; + thrower(std::move(base)); + } catch (const std::runtime_error &e) { + } + return 0; +} |