1 /* Verify that we don't offer #include suggestions for things that
2 aren't yet available due to the C++ dialect in use. */
3 // { dg-do compile { target c++98_only } }
8 void test_make_shared ()
10 std::make_shared<T>(); // { dg-error "'make_shared' is not a member of 'std'" }
11 // { dg-message "'std::make_shared' is only available from C\\+\\+11 onwards" "" { target *-*-* } .-1 }
12 // { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 }
13 // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 }
18 std::array a; // { dg-error "'array' is not a member of 'std'" }
19 // { dg-message "'std::array' is only available from C\\+\\+11 onwards" "" { target *-*-* } .-1 }
24 std::tuple<int,float> p; // { dg-error "'tuple' is not a member of 'std'" }
25 // { dg-message "'std::tuple' is only available from C\\+\\+11 onwards" "" { target *-*-* } .-1 }
26 // { dg-error "expected primary-expression before 'int'" "" { target *-*-* } .-2 }
30 std::shared_timed_mutex m; // { dg-error "'shared_timed_mutex' in namespace 'std' does not name a type" }
31 // { dg-message "'std::shared_timed_mutex' is only available from C\\+\\+14 onwards" "" { target *-*-* } .-1 }
34 std::string_view sv; // { dg-error "'string_view' in namespace 'std' does not name a type" }
35 // { dg-message "'std::string_view' is only available from C\\+\\+17 onwards" "" { target *-*-* } .-1 }
37 /* Verify interaction with "using namespace std;". */
39 void test_via_using_directive ()
41 shared_ptr<int> p; // { dg-error "'shared_ptr' was not declared in this scope" }
42 // { dg-message "'std::shared_ptr' is only available from C\\+\\+11 onwards" "" { target *-*-* } .-1 }
43 // { dg-error "expected primary-expression before 'int'" "" { target *-*-* } .-2 }