From: Marek Polacek Date: Wed, 5 Oct 2016 19:25:15 +0000 (+0000) Subject: Fix last commit. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8b6a4889eb29c1ddf65fd172f4f2c0a7d5f7d0d;p=gcc.git Fix last commit. From-SVN: r240806 --- diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement1.C b/gcc/testsuite/g++.dg/cpp1z/init-statement1.C index 1cebc3fec96..fbe0d8be011 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement1.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement1.C @@ -12,17 +12,3 @@ f (void) else bar (-p); } -// { dg-do compile { target c++11 } } -// { dg-options "" } - -extern int foo (void); -extern void bar (int); - -void -f (void) -{ - if (auto p = foo (); p > 10) // { dg-warning "init-statement" "" { target c++14_down } } - bar (p); - else - bar (-p); -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement2.C b/gcc/testsuite/g++.dg/cpp1z/init-statement2.C index 19d8e0c5813..8cfe1ab1d28 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement2.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement2.C @@ -60,65 +60,3 @@ f4 (void) if constexpr (constexpr auto s = sizeof (int); s > 10) foo (); } -// { dg-options -std=c++1z } -// Test C++17 selection statements with initializer, basic use. - -extern int foo (void); -extern void bar (int); -extern int g; - -void -f (void) -{ - if (auto p = foo (); p > 10) - bar (p); - else - bar (-p); - - if ((g += 2); g > 6) - bar (1); - - if (auto a = 9, b = foo (); a + b > 10) - bar (a + b); - else - bar (a - b); - - if (({ int a; 1;})) - bar (0); - - if (auto i = foo (); i > 6) - bar (0); - else if (i++; i > 8) - bar (1); -} - -extern void lock (void); - -void -f2 (int i) -{ - if (lock (); i > 10) - ++i; - else - --i; -} - -void -f3 (int i) -{ - switch (i *= 2; auto idx = i) - { - case 4: - bar (3); - break; - default: - break; - } -} - -void -f4 (void) -{ - if constexpr (constexpr auto s = sizeof (int); s > 10) - foo (); -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement3.C b/gcc/testsuite/g++.dg/cpp1z/init-statement3.C index 306c801d684..c178eafe1fb 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement3.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement3.C @@ -14,19 +14,3 @@ main () if (g != 2) __builtin_abort (); } -// { dg-do run } -// { dg-options -std=c++1z } -// Test C++17 selection statements with initializer, side-effects. - -int -main () -{ - int g = 0; - - if (g++; g > 1) - __builtin_abort (); - if (++g; g > 2) - __builtin_abort (); - if (g != 2) - __builtin_abort (); -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement4.C b/gcc/testsuite/g++.dg/cpp1z/init-statement4.C index 2a0a7d0648c..a5f7d8b0c9e 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement4.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement4.C @@ -41,65 +41,6 @@ f3 (void) } -void -f4 (void) -{ - { - if (auto i = foo (); i > -1) - { - if (i > 5) - bar (i); - if (auto j = foo (); true) - j++; - j--; // { dg-error "not declared" } - } - i = 10; // { dg-error "not declared" } - } - i = 10; // { dg-error "not declared" } -} -// { dg-options -std=c++1z } - -extern int foo (void); -extern void bar (int), die (void); - -void -f (void) -{ - if (auto i = foo (); i != -1) - bar (1); - else - die (); - - i = 10; // { dg-error "not declared" } -} - -void -f2 (void) -{ - switch (auto i = foo (); i) - { - case 0: - bar (i + 1); - break; - case 1: - bar (i + 10); - break; - default: - break; - } - - i = 10; // { dg-error "not declared" } -} - -void -f3 (void) -{ - if constexpr (constexpr auto i = sizeof (long); i < 2) - die (); - i = 4; // { dg-error "not declared" } -} - - void f4 (void) { diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement5.C b/gcc/testsuite/g++.dg/cpp1z/init-statement5.C index 9445abf68bd..6efa0ed30b2 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement5.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement5.C @@ -14,19 +14,3 @@ foo () if (status_code c = do_more_stuff (); c != status_code::SUCCESS) { return c; } return status_code::SUCCESS; } -// Testcase from P0305R1 -// { dg-options -std=c++1z } - -enum class status_code { SUCCESS }; -extern int get_value (); -status_code bar (int); -status_code do_more_stuff (void); - -status_code -foo () -{ - int n = get_value (); - if (status_code c = bar (n); c != status_code::SUCCESS) { return c; } - if (status_code c = do_more_stuff (); c != status_code::SUCCESS) { return c; } - return status_code::SUCCESS; -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement6.C b/gcc/testsuite/g++.dg/cpp1z/init-statement6.C index fe6518c2cca..53b0d31f545 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement6.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement6.C @@ -23,28 +23,3 @@ foo () // whatever } } -// Testcase from P0305R1 -// { dg-options -std=c++1z } - -#include -#include -#include - -std::map m; -extern int xread (int *); -extern void publish (int), raise (int); - -void -foo () -{ - if (auto it = m.find (10); it != m.end ()) { std::string s = it->second; } - if (char buf[10]; std::fgets(buf, 10, stdin)) { m[0] += buf; } - if (int s; int count = xread (&s)) { publish(count); raise(s); } - - const char *s; - if (auto keywords = {"if", "for", "while"}; - std::any_of(keywords.begin(), keywords.end(), [&s](const char* kw) { return s == kw; })) - { - // whatever - } -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement7.C b/gcc/testsuite/g++.dg/cpp1z/init-statement7.C index 0b9cb93610f..a67617ef0e2 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement7.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement7.C @@ -7,12 +7,3 @@ main () if (int i = 10, &ir = i; [=]{ return ir; }() != 10) __builtin_abort (); } -// { dg-do run } -// { dg-options -std=c++1z } - -int -main () -{ - if (int i = 10, &ir = i; [=]{ return ir; }() != 10) - __builtin_abort (); -} diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement8.C b/gcc/testsuite/g++.dg/cpp1z/init-statement8.C index 3dccd1691dc..fb40df0e5b4 100644 --- a/gcc/testsuite/g++.dg/cpp1z/init-statement8.C +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement8.C @@ -8,13 +8,3 @@ f () return 5; return 0; } -// { dg-options -std=c++1z } - -int -f () -{ - if (int c = 5; - int c = 5) // { dg-error "redeclaration" } - return 5; - return 0; -}