On 10/11/2017 04:59 PM, Jason Merrill wrote: > On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška <mli...@suse.cz> wrote: >> On 10/05/2017 05:07 PM, Jason Merrill wrote: >>> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mli...@suse.cz> wrote: >>>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says >>>> that having a non-return >>>> function with missing return statement is undefined behavior. We've got >>>> -fsanitize=return check for >>>> that and we can in such case instrument __builtin_unreachable(). This >>>> patch does that. >>> >>> >>> Great. >>> >>>> And there's still some fallout: >>>> >>>> FAIL: g++.dg/cpp0x/constexpr-diag3.C -std=c++11 (test for errors, line >>>> 7) >>>> FAIL: g++.dg/cpp0x/constexpr-neg3.C -std=c++11 (test for errors, line >>>> 12) >>>> FAIL: g++.dg/cpp1y/constexpr-return2.C -std=c++14 (test for errors, >>>> line 7) >>>> FAIL: g++.dg/cpp1y/constexpr-return2.C -std=c++14 (test for excess >>>> errors) >>>> FAIL: g++.dg/cpp1y/pr63996.C -std=c++14 (test for errors, line 9) >>>> FAIL: g++.dg/cpp1y/pr63996.C -std=c++14 (test for excess errors) >>>> >>>> 1) there are causing: >>>> >>>> ./xg++ -B. >>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C >>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23: >>>> in constexpr expansion of ‘foo(1)’ >>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1: >>>> error: ‘__builtin_unreachable()’ is not a constant expression >>>> foo (int i) >>>> ^~~ >>>> >>>> Where we probably should not emit the built-in call. Am I right? >>> >>> >>> Or constexpr.c could give a more friendly diagnostic for >>> __builtin_unreachable. It's correct to give a diagnostic here for >>> this testcase. >> >> >> Hi. >> >> That's good idea, any suggestion different from: >> >> ./xg++ -B. >> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C >> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23: >> in constexpr expansion of ‘foo(1)’ >> <built-in>: error: constexpr can't contain call of a non-return function >> ‘__builtin_unreachable’ >> >> which is probably misleading as it points to a function call that is >> actually missing in source code. >> Should we distinguish between implicit and explicit __builtin_unreachable? > > Probably without your change the constexpr code already diagnoses the > missing return as "constexpr call flows off the end of the function"; > that same message seems appropriate.
Hello. Ok, I've done that. Sending patch candidate. > >> So turning on the warning by default for c++, we get about 500 failing >> test-cases. Uf :/ > > Yes, we've been sloppy about this in the testsuite. :( I'll fix it. For being sure, I'm sending first part where I demonstrate how I plan to change tests, with following preference: 1) change function to void type if possible 2) return a default value for functions not returning a value (for complex return value of a type A: I do { static A a; return a; } is it appropriate? Thanks for feedback. If it's fine, then I'll carry on. Martin > > Jason >
>From 56c6520d86cba32d04cdbd8873243a7ab801975f Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 12 Oct 2017 10:14:59 +0200 Subject: [PATCH] Instrument function exit with __builtin_unreachable in C++ gcc/c-family/ChangeLog: 2017-10-12 Martin Liska <mli...@suse.cz> PR middle-end/82404 * c-opts.c (c_common_post_options): Set -Wreturn-type for C++ FE. * c.opt: Set default value of warn_return_type. gcc/cp/ChangeLog: 2017-10-12 Martin Liska <mli...@suse.cz> PR middle-end/82404 * constexpr.c (cxx_eval_builtin_function_call): Handle __builtin_unreachable call. * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to ... (cp_maybe_instrument_return): ... this. (cp_genericize): Call the function unconditionally. gcc/fortran/ChangeLog: 2017-10-12 Martin Liska <mli...@suse.cz> PR middle-end/82404 * options.c (gfc_post_options): Set default value of -Wreturn-type to false. --- gcc/c-family/c-opts.c | 3 +++ gcc/c-family/c.opt | 2 +- gcc/cp/constexpr.c | 7 ++++++- gcc/cp/cp-gimplify.c | 18 ++++++++++++------ gcc/fortran/options.c | 3 +++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 3662aa37be6..afea6a3dca3 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename) flag_extern_tls_init = 1; } + if (warn_return_type == -1) + warn_return_type = c_dialect_cxx () ? 1 : 0; + if (num_in_fnames > 1) error ("too many filenames given. Type %s --help for usage", progname); diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 13d2a59b8a5..e26fba734c0 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -960,7 +960,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall) Warn when the compiler reorders code. Wreturn-type -C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) +C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Init(-1) Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++). Wscalar-storage-order diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 8a5be2079d8..cf935902216 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun, { new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t), CALL_EXPR_FN (t), nargs, args); - error ("%q+E is not a constant expression", new_call); + + /* Do not allow__builtin_unreachable in constexpr function. */ + if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE) + error ("constexpr call flows off the end of the function"); + else + error ("%q+E is not a constant expression", new_call); } *non_constant_p = true; return t; diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 262485a5c1f..0bf8f567d5b 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p) /* If a function that should end with a return in non-void function doesn't obviously end with return, add ubsan - instrumentation code to verify it at runtime. */ + instrumentation code to verify it at runtime. If -fsanitize=return + is not enabled, instrument __builtin_unreachable. */ static void -cp_ubsan_maybe_instrument_return (tree fndecl) +cp_maybe_instrument_return (tree fndecl) { if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))) || DECL_CONSTRUCTOR_P (fndecl) @@ -1600,7 +1601,14 @@ cp_ubsan_maybe_instrument_return (tree fndecl) tree *p = &DECL_SAVED_TREE (fndecl); if (TREE_CODE (*p) == BIND_EXPR) p = &BIND_EXPR_BODY (*p); - t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl)); + + location_t loc = DECL_SOURCE_LOCATION (fndecl); + if (sanitize_flags_p (SANITIZE_RETURN, fndecl)) + t = ubsan_instrument_return (loc); + else + t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE), + 0); + append_to_statement_list (t, p); } @@ -1674,9 +1682,7 @@ cp_genericize (tree fndecl) walk_tree's hash functionality. */ cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true); - if (sanitize_flags_p (SANITIZE_RETURN) - && current_function_decl != NULL_TREE) - cp_ubsan_maybe_instrument_return (fndecl); + cp_maybe_instrument_return (fndecl); /* Do everything else. */ c_genericize (fndecl); diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index f7bbd7f2cde..59e7f028b09 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -430,6 +430,9 @@ gfc_post_options (const char **pfilename) gfc_fatal_error ("Maximum subrecord length cannot exceed %d", MAX_SUBRECORD_LENGTH); + if (warn_return_type == -1) + warn_return_type = 0; + gfc_cpp_post_options (); if (gfc_option.allow_std & GFC_STD_F2008) -- 2.14.2
>From 50906b825d6b694ca64edf8ec8f0b3a619045708 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 12 Oct 2017 10:10:51 +0200 Subject: [PATCH] Fix test-suite fallout. --- gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c | 12 ++++++------ gcc/testsuite/c-c++-common/asan/pr63638.c | 2 +- gcc/testsuite/c-c++-common/goacc/parallel-1.c | 2 ++ gcc/testsuite/c-c++-common/gomp/sink-1.c | 2 ++ gcc/testsuite/c-c++-common/missing-symbol.c | 3 ++- gcc/testsuite/c-c++-common/pr36513.c | 2 ++ gcc/testsuite/c-c++-common/pr49706-2.c | 2 +- gcc/testsuite/c-c++-common/pr65120.c | 4 ++-- gcc/testsuite/c-c++-common/tm/volatile-1.c | 2 +- gcc/testsuite/c-c++-common/vector-1.c | 2 +- gcc/testsuite/c-c++-common/vector-2.c | 2 +- gcc/testsuite/g++.dg/abi/abi-tag14.C | 8 ++++---- gcc/testsuite/g++.dg/abi/abi-tag18.C | 4 ++++ gcc/testsuite/g++.dg/abi/abi-tag18a.C | 4 ++++ gcc/testsuite/g++.dg/abi/covariant2.C | 4 ++-- gcc/testsuite/g++.dg/abi/covariant3.C | 2 +- gcc/testsuite/g++.dg/abi/mangle7.C | 2 +- gcc/testsuite/g++.dg/asan/pr81340.C | 4 ++-- gcc/testsuite/g++.dg/concepts/fn8.C | 2 +- gcc/testsuite/g++.dg/concepts/pr65575.C | 2 +- gcc/testsuite/g++.dg/concepts/template-parm11.C | 2 +- gcc/testsuite/g++.dg/conversion/op6.C | 6 +++--- gcc/testsuite/g++.dg/cpp0x/access01.C | 2 +- gcc/testsuite/g++.dg/cpp0x/alignas3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C | 2 ++ gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C | 5 +++++ gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C | 4 ++-- gcc/testsuite/g++.dg/cpp0x/dc1.C | 2 +- gcc/testsuite/g++.dg/cpp0x/dc3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/decltype3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/decltype41.C | 8 ++++---- gcc/testsuite/g++.dg/cpp0x/defaulted28.C | 2 +- gcc/testsuite/g++.dg/cpp0x/enum_base3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C | 1 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C | 2 ++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C | 1 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C | 1 + gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C | 2 +- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C | 2 +- gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C | 6 +++--- gcc/testsuite/g++.dg/cpp0x/parse1.C | 2 +- gcc/testsuite/g++.dg/cpp0x/pr34054.C | 2 +- gcc/testsuite/g++.dg/cpp0x/pr70538.C | 2 +- gcc/testsuite/g++.dg/cpp0x/pr81325.C | 2 +- gcc/testsuite/g++.dg/cpp0x/range-for13.C | 2 ++ gcc/testsuite/g++.dg/cpp0x/range-for14.C | 2 ++ gcc/testsuite/g++.dg/cpp0x/rv2n.C | 4 ++++ gcc/testsuite/g++.dg/cpp0x/rv3n.C | 1 + gcc/testsuite/g++.dg/cpp0x/static_assert10.C | 1 + gcc/testsuite/g++.dg/cpp0x/static_assert11.C | 1 + gcc/testsuite/g++.dg/cpp0x/static_assert12.C | 2 +- gcc/testsuite/g++.dg/cpp0x/static_assert13.C | 2 +- gcc/testsuite/g++.dg/cpp0x/trailing1.C | 4 ++-- gcc/testsuite/g++.dg/cpp0x/trailing5.C | 4 ++-- gcc/testsuite/gcc.dg/pr44545.c | 2 +- 60 files changed, 102 insertions(+), 64 deletions(-) diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c index 0ed7928fd79..d146c788b74 100644 --- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c +++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c @@ -4,7 +4,7 @@ extern void grace (int); -int +void fn1 (int i) { switch (i) @@ -16,7 +16,7 @@ fn1 (int i) done:; } -int +void fn2 (int i) { switch (i) @@ -32,7 +32,7 @@ fn2 (int i) done:; } -int +void fn3 (int i) { switch (i) @@ -46,7 +46,7 @@ fn3 (int i) done:; } -int +void fn4 (int i) { switch (i) @@ -64,7 +64,7 @@ fn4 (int i) done:; } -int +void fn5 (int i) { switch (i) @@ -83,7 +83,7 @@ fn5 (int i) done:; } -int +void fn6 (int i) { switch (i) diff --git a/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc/testsuite/c-c++-common/asan/pr63638.c index a8bafc5aad7..619a2b6142a 100644 --- a/gcc/testsuite/c-c++-common/asan/pr63638.c +++ b/gcc/testsuite/c-c++-common/asan/pr63638.c @@ -12,7 +12,7 @@ struct S{ struct S s[6]; -int f(struct S *p) +void f(struct S *p) { memcpy(p, &s[2], sizeof(*p)); memcpy(p, &s[1], sizeof(*p)); diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-1.c b/gcc/testsuite/c-c++-common/goacc/parallel-1.c index 6c6cc88ecad..0afc53adaa8 100644 --- a/gcc/testsuite/c-c++-common/goacc/parallel-1.c +++ b/gcc/testsuite/c-c++-common/goacc/parallel-1.c @@ -35,4 +35,6 @@ parallel_clauses (void) #pragma acc parallel firstprivate (a, b) ; + + return 0; } diff --git a/gcc/testsuite/c-c++-common/gomp/sink-1.c b/gcc/testsuite/c-c++-common/gomp/sink-1.c index 4872a072315..5ee562bfbf7 100644 --- a/gcc/testsuite/c-c++-common/gomp/sink-1.c +++ b/gcc/testsuite/c-c++-common/gomp/sink-1.c @@ -93,4 +93,6 @@ baz () bar (i, j, 0); #pragma omp ordered depend(source) } + + return 0; } diff --git a/gcc/testsuite/c-c++-common/missing-symbol.c b/gcc/testsuite/c-c++-common/missing-symbol.c index 33a501b9988..cbcde1f1cae 100644 --- a/gcc/testsuite/c-c++-common/missing-symbol.c +++ b/gcc/testsuite/c-c++-common/missing-symbol.c @@ -1,4 +1,4 @@ -/* { dg-options "-fdiagnostics-show-caret" } */ +/* { dg-options "-fdiagnostics-show-caret -Wno-return-type" } */ extern int foo (void); extern int bar (void); @@ -21,6 +21,7 @@ int missing_close_paren_in_switch (int i) default: return i; } + } /* { dg-error "1: expected" } */ /* { dg-begin-multiline-output "" } } diff --git a/gcc/testsuite/c-c++-common/pr36513.c b/gcc/testsuite/c-c++-common/pr36513.c index 026325410a1..b8b2d6d8060 100644 --- a/gcc/testsuite/c-c++-common/pr36513.c +++ b/gcc/testsuite/c-c++-common/pr36513.c @@ -11,5 +11,7 @@ int main1 () && (t) == '\0' ? (char *) __rawmemchr (s, t) : __builtin_strchr (s, t))); + + return 0; } diff --git a/gcc/testsuite/c-c++-common/pr49706-2.c b/gcc/testsuite/c-c++-common/pr49706-2.c index 09cc9eb1407..30a46c286e0 100644 --- a/gcc/testsuite/c-c++-common/pr49706-2.c +++ b/gcc/testsuite/c-c++-common/pr49706-2.c @@ -10,7 +10,7 @@ bool r; -int +void same (int a, int b) { r = !a == !b; diff --git a/gcc/testsuite/c-c++-common/pr65120.c b/gcc/testsuite/c-c++-common/pr65120.c index c9c1f5f7e65..c8762e057d5 100644 --- a/gcc/testsuite/c-c++-common/pr65120.c +++ b/gcc/testsuite/c-c++-common/pr65120.c @@ -9,7 +9,7 @@ bool r; -int +void f1 (int a) { r = !a == 0; @@ -18,7 +18,7 @@ f1 (int a) r = !a != 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ } -int +void f2 (int a) { r = !a > 0; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ diff --git a/gcc/testsuite/c-c++-common/tm/volatile-1.c b/gcc/testsuite/c-c++-common/tm/volatile-1.c index eb3799dd972..40b41803555 100644 --- a/gcc/testsuite/c-c++-common/tm/volatile-1.c +++ b/gcc/testsuite/c-c++-common/tm/volatile-1.c @@ -3,7 +3,7 @@ volatile int * p = 0; __attribute ((transaction_safe)) -int f() { +void f() { int x = 0; // ok: not volatile p = &x; // ok: the pointer is not volatile int i = *p; // { dg-error "volatile" "read through volatile glvalue" } diff --git a/gcc/testsuite/c-c++-common/vector-1.c b/gcc/testsuite/c-c++-common/vector-1.c index 288dd1e924c..027d1777943 100644 --- a/gcc/testsuite/c-c++-common/vector-1.c +++ b/gcc/testsuite/c-c++-common/vector-1.c @@ -8,7 +8,7 @@ vector float a; vector int a1; -int f(void) +void f(void) { a = ~a; /* { dg-error "" } */ a1 = ~a1; diff --git a/gcc/testsuite/c-c++-common/vector-2.c b/gcc/testsuite/c-c++-common/vector-2.c index e9f40a35892..9db53a88c5f 100644 --- a/gcc/testsuite/c-c++-common/vector-2.c +++ b/gcc/testsuite/c-c++-common/vector-2.c @@ -9,7 +9,7 @@ vector int a1; vector float b; vector int b1; -int f(void) +void f(void) { a = a | b; /* { dg-error "" } */ a = a & b; /* { dg-error "" } */ diff --git a/gcc/testsuite/g++.dg/abi/abi-tag14.C b/gcc/testsuite/g++.dg/abi/abi-tag14.C index a66e6552cba..3017f492cda 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag14.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag14.C @@ -8,20 +8,20 @@ inline namespace __cxx11 __attribute ((abi_tag ("cxx11"))) { A a; // { dg-warning "\"cxx11\"" } // { dg-final { scan-assembler "_Z1fB5cxx11v" } } -A f() {} // { dg-warning "\"cxx11\"" } +A f() { return a; } // { dg-warning "\"cxx11\"" } namespace { A a2; - A f2() {} + A f2() { return a2; } struct B: A {}; } // { dg-final { scan-assembler "_Z1fPN7__cxx111AE" } } -A f(A*) {} +A f(A*) { return a; } // { dg-final { scan-assembler "_Z1gIN7__cxx111AEET_v" } } template <class T> T g() { } -template <> A g<A>() { } +template <> A g<A>() { return a; } // { dg-final { scan-assembler "_Z1vIN7__cxx111AEE" { target c++14 } } } #if __cplusplus >= 201402L diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18.C b/gcc/testsuite/g++.dg/abi/abi-tag18.C index 89ee737bf57..7963b0c91ba 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag18.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag18.C @@ -11,9 +11,13 @@ inline A1 f() { struct T { A2 g() { // { dg-warning "mangled name" } static X x; // { dg-warning "mangled name" } + static A2 a2; + return a2; } }; T().g(); + static A1 a; + return a; } int main() { f(); diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18a.C b/gcc/testsuite/g++.dg/abi/abi-tag18a.C index f65f629bd94..a0f191e096e 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag18a.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag18a.C @@ -11,9 +11,13 @@ inline A1 f() { struct T { A2 g() { static X x; + static A2 a2; + return a2; } }; T().g(); + static A1 a; + return a; } int main() { f(); diff --git a/gcc/testsuite/g++.dg/abi/covariant2.C b/gcc/testsuite/g++.dg/abi/covariant2.C index 3231cc4c84c..6c55ad6bb67 100644 --- a/gcc/testsuite/g++.dg/abi/covariant2.C +++ b/gcc/testsuite/g++.dg/abi/covariant2.C @@ -10,7 +10,7 @@ struct c1 {}; struct c3 : virtual c1 { - virtual c1* f6() {} + virtual c1* f6() { return 0; } int i; }; @@ -18,7 +18,7 @@ struct c6 : virtual c3 { }; struct c7 : c3 { - virtual c3* f6() {} + virtual c3* f6() { return 0; } }; struct c24 : virtual c7 diff --git a/gcc/testsuite/g++.dg/abi/covariant3.C b/gcc/testsuite/g++.dg/abi/covariant3.C index 178157c58b2..09b9912524d 100644 --- a/gcc/testsuite/g++.dg/abi/covariant3.C +++ b/gcc/testsuite/g++.dg/abi/covariant3.C @@ -34,7 +34,7 @@ struct c28 : virtual c0, virtual c11 { virtual c18* f6(); }; -c0 *c1::f6 () {} +c0 *c1::f6 () { return 0; } void c5::foo () {} void c10::foo () {} void c18::bar () {} diff --git a/gcc/testsuite/g++.dg/abi/mangle7.C b/gcc/testsuite/g++.dg/abi/mangle7.C index af178d3e599..14c65a24da8 100644 --- a/gcc/testsuite/g++.dg/abi/mangle7.C +++ b/gcc/testsuite/g++.dg/abi/mangle7.C @@ -1,6 +1,6 @@ /* { dg-do compile } */ typedef void *const t1[2]; -float const f1(t1 (&)[79], ...) {} +float const f1(t1 (&)[79], ...) { return 0.0f; } /* { dg-final { scan-assembler _Z2f1RA79_A2_KPvz } } */ diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C index 76ac08a9a56..9db5bb46ce7 100644 --- a/gcc/testsuite/g++.dg/asan/pr81340.C +++ b/gcc/testsuite/g++.dg/asan/pr81340.C @@ -10,13 +10,13 @@ public: a(char *) : c(0, d) {} }; class e { - int f(const int &, const int &, const int &, bool, bool, bool, int, bool); + void f(const int &, const int &, const int &, bool, bool, bool, int, bool); }; class g { public: static g *h(); void i(a, void *); }; -int e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) { +void e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) { g::h()->i("", &j); } diff --git a/gcc/testsuite/g++.dg/concepts/fn8.C b/gcc/testsuite/g++.dg/concepts/fn8.C index 5c796c7e3b2..b91f1ae9511 100644 --- a/gcc/testsuite/g++.dg/concepts/fn8.C +++ b/gcc/testsuite/g++.dg/concepts/fn8.C @@ -12,7 +12,7 @@ void (*p2)(int) = &f<int>; // { dg-error "no matches" } void (*p3)(int) = &f; // { dg-error "no matches" } struct S { - template<Class T> int f(T) { } + template<Class T> int f(T) { return 0; } }; auto p4 = &S::template f<int>; // { dg-error "no matches" } diff --git a/gcc/testsuite/g++.dg/concepts/pr65575.C b/gcc/testsuite/g++.dg/concepts/pr65575.C index e027dccf7d8..6745b843d31 100644 --- a/gcc/testsuite/g++.dg/concepts/pr65575.C +++ b/gcc/testsuite/g++.dg/concepts/pr65575.C @@ -14,7 +14,7 @@ int (*p)() requires true; // { dg-error "" } int (&p)() requires true; // { dg-error "" } int g(int (*)() requires true); // { dg-error "" } -int f() { } +int f() { return 0; } int main() diff --git a/gcc/testsuite/g++.dg/concepts/template-parm11.C b/gcc/testsuite/g++.dg/concepts/template-parm11.C index 73f38815fb7..352acc2271d 100644 --- a/gcc/testsuite/g++.dg/concepts/template-parm11.C +++ b/gcc/testsuite/g++.dg/concepts/template-parm11.C @@ -12,7 +12,7 @@ template<NameProvider... ColSpec> void getTable(const ColSpec&...) {} -int f() +void f() { getTable(7, 'a'); // { dg-error "cannot call" } }; diff --git a/gcc/testsuite/g++.dg/conversion/op6.C b/gcc/testsuite/g++.dg/conversion/op6.C index 9aec9f0a808..8a5efc4023a 100644 --- a/gcc/testsuite/g++.dg/conversion/op6.C +++ b/gcc/testsuite/g++.dg/conversion/op6.C @@ -3,9 +3,9 @@ template<class T> class smart_pointer { public: - operator T* () const { } - operator bool () const { } - operator bool () { } + operator T* () const { return 0; } + operator bool () const { return true; } + operator bool () { return true; } }; class Context { }; typedef smart_pointer<Context> ContextP; diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C index 55c951f97d6..3a7cee4156a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/access01.C +++ b/gcc/testsuite/g++.dg/cpp0x/access01.C @@ -6,7 +6,7 @@ class A { T p; public: - template <class U> auto f() -> decltype(+p) { } + template <class U> auto f() -> decltype(+p) { return p; } }; int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas3.C b/gcc/testsuite/g++.dg/cpp0x/alignas3.C index aa62e5afb2d..af3f171bb3f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alignas3.C +++ b/gcc/testsuite/g++.dg/cpp0x/alignas3.C @@ -16,5 +16,5 @@ template <class, class Y> typename F<Y>::ret_type cast(Y &); class CompoundStmt; class alignas(8) Stmt { Stmt *Children[1]; - CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); } + CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); return 0; } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C index c6afa507f02..a43d1df463f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C @@ -18,6 +18,8 @@ struct D { template <typename _ForwardIterator, typename _Size> static _ForwardIterator __uninit_default_n(_ForwardIterator p1, _Size) { _Construct(p1); + static _ForwardIterator a; + return a; } }; template <typename _ForwardIterator, typename _Size> diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C index f1ca05fe9ec..f6e0710b4d2 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C @@ -25,6 +25,8 @@ struct A : D A baz (const char *, A = C ()); +A a; + A B::foo () { @@ -35,10 +37,13 @@ B::foo () catch (...) { } + + return a; } A B::bar () { baz ("bar"); + return a; } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C index d59f465715d..d58e2ec6b15 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C @@ -13,6 +13,6 @@ constexpr X X::g(X x) { return x; } struct Y { Y() { } - constexpr Y f(Y y) {} // { dg-error "constexpr" } - static constexpr Y g(Y y) {} // { dg-error "constexpr" } + constexpr Y f(Y y) { return y; } // { dg-error "constexpr" } + static constexpr Y g(Y y) { return y; } // { dg-error "constexpr" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/dc1.C b/gcc/testsuite/g++.dg/cpp0x/dc1.C index e7ccb64a3b3..5ce50764b5f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/dc1.C +++ b/gcc/testsuite/g++.dg/cpp0x/dc1.C @@ -27,7 +27,7 @@ struct D : public C { D (int _i) : C(), i(_i) { } D () : D(-1) { } virtual ~D() { } - virtual int f () { } + virtual int f () { return 0; } }; void f_D () { C* c = new D(); } diff --git a/gcc/testsuite/g++.dg/cpp0x/dc3.C b/gcc/testsuite/g++.dg/cpp0x/dc3.C index 9c6fd56564c..9c1fd53e4fe 100644 --- a/gcc/testsuite/g++.dg/cpp0x/dc3.C +++ b/gcc/testsuite/g++.dg/cpp0x/dc3.C @@ -43,7 +43,7 @@ struct D<X> : public C { D (int _i) : C(), i(_i) { } D () : D(-1) { } virtual ~D() { } - virtual int f () { } + virtual int f () { return 0; } }; void f_D () { D<X>* d = new D<X>(); } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype3.C b/gcc/testsuite/g++.dg/cpp0x/decltype3.C index b2e66243cc7..b921dd6d899 100644 --- a/gcc/testsuite/g++.dg/cpp0x/decltype3.C +++ b/gcc/testsuite/g++.dg/cpp0x/decltype3.C @@ -49,7 +49,7 @@ public: int a; enum B_enum { b }; decltype(a) c; - decltype(a) foo() { } + decltype(a) foo() { return 0; } decltype(b) enums_are_in_scope() { return b; } // ok }; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype41.C b/gcc/testsuite/g++.dg/cpp0x/decltype41.C index 1439e15c0d4..65f75b1e4fa 100644 --- a/gcc/testsuite/g++.dg/cpp0x/decltype41.C +++ b/gcc/testsuite/g++.dg/cpp0x/decltype41.C @@ -23,15 +23,15 @@ class B template <class T> struct C { - template <class U> decltype (a.i) f() { } // #1 - template <class U> decltype (b.i) f() { } // #2 + template <class U> decltype (a.i) f() { return 0; } // #1 + template <class U> decltype (b.i) f() { return 1; } // #2 }; template <class T> struct D { - template <class U> decltype (A::j) f() { } // #1 - template <class U> decltype (B::j) f() { } // #2 + template <class U> decltype (A::j) f() { return 2; } // #1 + template <class U> decltype (B::j) f() { return 3; } // #2 }; int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C index 451a1b4198f..0e04dbfb8d7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C @@ -9,7 +9,7 @@ private: A(A const&) = default; // { dg-message "private" } }; -int f(...) { } +int f(...) { return 0; } int main() { A a; f(a); // { dg-error "this context" } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C index 3cb2d6d8186..1437f5fbcf1 100644 --- a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C +++ b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C @@ -17,7 +17,7 @@ struct C }; struct D : C { - B foo () const { B a; a.foo (d); } + B foo () const { B a; a.foo (d); static B b; return b; } H d; }; struct F : C diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C index eb585a89be4..023d8396777 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C @@ -22,7 +22,7 @@ void two [[gnu::unused]] (void) {} int five(void) [[noreturn]] // { dg-warning "ignored" } -{} +{ return 0; } [[noreturn]] void diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C index 3101d0a895c..7bcfe3ae70b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C @@ -6,5 +6,6 @@ struct A int foo() { [this]{ return foo; }; // { dg-error "invalid use of member function|cannot convert" } + return 0; } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C index 8e806c849ae..5edfedf72eb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C @@ -3,7 +3,7 @@ template <typename F> struct Tag { static void fp() { f()(0); } - static F f() {} + static F f() { static F a; return a; } }; struct Dispatch { diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C index 16adee6b9c3..e5655cec9c7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C @@ -10,7 +10,7 @@ template <typename F> struct B<F> { using type = F; }; struct { template <typename... F, typename Overload = typename B<typename A<F>::type...>::type> - Overload operator()(F...){} + Overload operator()(F...){ Overload a; return a; } } a; int main() { auto f = a([](int) {}, [](float) {}); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C index 1c593930133..d85d358b7e4 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C @@ -10,7 +10,7 @@ struct function template<typename T> struct C { - static T test(function f = [](int i){return i;}) { } + static T test(function f = [](int i){return i;}) { static T a; return a; } }; int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C index fa8a6e63a93..371d03f941f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C @@ -14,6 +14,8 @@ bool Klass::dostuff() if (local & 1) { return true; } // { dg-error "not captured|non-static" } return false; }; + + return true; } int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C index 914e0f71e00..50a340dbb22 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C @@ -4,6 +4,7 @@ template<int> int foo() { [] (void i) { return 0; } (0); // { dg-error "incomplete|invalid|no match" } + return 0; } void bar() diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C index 9e509513ad9..27954f9408c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C @@ -13,7 +13,7 @@ void f1(int i) { }; struct s1 { int f; - int work(int n) { + void work(int n) { int m = n*n; int j = 40; auto m3 = [this,m]{ diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C index 635af97d763..5dfd6ede19c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C @@ -14,6 +14,7 @@ class X [&a]{ typename remove_reference < decltype (a) >::type t; }; + return true; } }; template class X< int >; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C index 29f63afe0df..8fbb821a4d3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C @@ -10,7 +10,7 @@ struct T foo (S<N> *p) { S<N> u; - [&u] ()->bool {} (); + [&u] ()->bool { return true; } (); } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C index ef573b19e02..41e4edd8a0f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C @@ -3,7 +3,7 @@ struct A { - int f() {} + int f() { return 0; } int i; void foo() diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C index fdaf4611ee2..5f23d463003 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C @@ -7,7 +7,7 @@ template<> struct A1<0> { template<typename, typename...> struct B1 { - template<typename> int foo1() {} + template<typename> int foo1() { return 0; } int i1 = foo1<int>(); }; @@ -19,7 +19,7 @@ template<> struct A2<0> { template<typename, typename> struct B2 { - template<typename> int foo2() {} + template<typename> int foo2() { return 1; } int i2 = foo2<int>(); }; @@ -31,7 +31,7 @@ template<> struct A3<0> { template<typename> struct B3 { - template<typename> int foo3() {} + template<typename> int foo3() { return 2; } int i3 = foo3<int>(); }; diff --git a/gcc/testsuite/g++.dg/cpp0x/parse1.C b/gcc/testsuite/g++.dg/cpp0x/parse1.C index 5a11b7337a4..9a2698435b6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/parse1.C +++ b/gcc/testsuite/g++.dg/cpp0x/parse1.C @@ -2,4 +2,4 @@ // { dg-do compile { target c++11 } } typedef int B; // { dg-message "" } -B::B() {} // { dg-error "" } +B::B() { return 0; } // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr34054.C b/gcc/testsuite/g++.dg/cpp0x/pr34054.C index 8043f9660ed..dbb14e02cda 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr34054.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr34054.C @@ -1,4 +1,4 @@ // PR c++/34054 // { dg-do compile { target c++11 } } -template<typename... T> T foo() {} // { dg-error "not expanded|T" } +template<typename... T> T foo() { static T a; return a; } // { dg-error "not expanded|T" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr70538.C b/gcc/testsuite/g++.dg/cpp0x/pr70538.C index 0347c856c55..5f4d8585f76 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr70538.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr70538.C @@ -11,5 +11,5 @@ class B { template <typename> class C : B { using base_type = B; base_type::base_type; // { dg-warning "access declarations" } - PathComponentPiece m_fn1() {} + PathComponentPiece m_fn1() { static PathComponentPiece a; return a; } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr81325.C b/gcc/testsuite/g++.dg/cpp0x/pr81325.C index 11f0900caa2..d6015776968 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr81325.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr81325.C @@ -35,7 +35,7 @@ struct I { }; template <typename ResultT, typename ArgT> struct J { void operator()(); - ResultT operator()(ArgT) {} + ResultT operator()(ArgT) { static ResultT a; return a; } }; struct K { int AllowBind; diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for13.C b/gcc/testsuite/g++.dg/cpp0x/range-for13.C index 100f531f760..9ed0458adcc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/range-for13.C +++ b/gcc/testsuite/g++.dg/cpp0x/range-for13.C @@ -7,10 +7,12 @@ template<typename T> int *begin(T &t) { T::fail; + return 0; } template<typename T> int *end(T &t) { T::fail; + return 0; } struct container1 diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for14.C b/gcc/testsuite/g++.dg/cpp0x/range-for14.C index f43e1abcde7..4e0333cf927 100644 --- a/gcc/testsuite/g++.dg/cpp0x/range-for14.C +++ b/gcc/testsuite/g++.dg/cpp0x/range-for14.C @@ -7,10 +7,12 @@ template<typename T> int *begin(T &t) { T::fail; + return 0; } template<typename T> int *end(T &t) { T::fail; + return 0; } //Test for defaults diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C index 663a66b6d90..55979c85508 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C @@ -144,6 +144,7 @@ int test2_18() sink_2_18(ca); // { dg-error "" } sink_2_18(va); // { dg-error "" } sink_2_18(cva); // { dg-error "" } + return 0; } two sink_2_23(const A&); @@ -250,6 +251,7 @@ int test2_28() const volatile A cva = a; // { dg-error "deleted" } sink_2_28(va); // { dg-error "" } sink_2_28(cva); // { dg-error "" } + return 0; } three sink_2_35(volatile A&); @@ -439,6 +441,7 @@ int test2_68() sink_2_68(ca); // { dg-error "" } sink_2_68(va); // { dg-error "" } sink_2_68(cva); // { dg-error "" } + return 0; } seven sink_2_78(volatile A&&); @@ -454,6 +457,7 @@ int test2_78() sink_2_78(ca); // { dg-error "" } sink_2_78(va); // { dg-error "" } sink_2_78(cva); // { dg-error "" } + return 0; } int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C index b7c1d7a2343..4549438f8ef 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C @@ -124,6 +124,7 @@ int test3_128() sink_3_128(va); // { dg-error "" } sink_3_128(cva); // { dg-error "" } + return 0; } one sink_3_134( A&); diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C index e7f728e3f4f..ffbf3c047eb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C @@ -5,4 +5,5 @@ template<typename T> bool foo(T) { int i; static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable|non-constexpr" } + return true; } diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C index 8a7362d5f56..36bf458e25f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C @@ -6,5 +6,6 @@ struct A template<typename T> bool foo(T) { static_assert(foo(0), "Error"); // { dg-error "non-constant condition|constant expression" } + return true; } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C index ff6f40d918f..5d59e540910 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C @@ -14,7 +14,7 @@ template<> }; template<typename T> - T + void float_thing(T __x) { static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" } diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C index 86b0b0360d9..7332ff91882 100644 --- a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C @@ -14,7 +14,7 @@ template<> }; template<typename T> - T + void float_thing(T __x) { static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" } diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing1.C b/gcc/testsuite/g++.dg/cpp0x/trailing1.C index 7d9a906d4f3..6f18c1e47bd 100644 --- a/gcc/testsuite/g++.dg/cpp0x/trailing1.C +++ b/gcc/testsuite/g++.dg/cpp0x/trailing1.C @@ -40,9 +40,9 @@ decltype(*(T*)0+*(U*)0) add4(T t, U u) template <class T> struct A { - T f() {} + T f() { static T a; return a; } template <class U> - T g() {} + T g() { static T a; return a; } template <class V> struct B { diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing5.C b/gcc/testsuite/g++.dg/cpp0x/trailing5.C index 48f31452e5b..31a5350e687 100644 --- a/gcc/testsuite/g++.dg/cpp0x/trailing5.C +++ b/gcc/testsuite/g++.dg/cpp0x/trailing5.C @@ -2,9 +2,9 @@ // { dg-do compile { target c++11 } } struct A {}; -auto foo() -> struct A {} +auto foo() -> struct A { static A a; return a; } enum B {}; -auto bar() -> enum B {} +auto bar() -> enum B { static B b; return b; } auto baz() -> struct C {} {} // { dg-error "" } diff --git a/gcc/testsuite/gcc.dg/pr44545.c b/gcc/testsuite/gcc.dg/pr44545.c index 51983ef76b9..8058261f850 100644 --- a/gcc/testsuite/gcc.dg/pr44545.c +++ b/gcc/testsuite/gcc.dg/pr44545.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */ -int +void DrawChunk(int *tabSize, int x) { const int numEnds = 10; -- 2.14.2