aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-08-14 20:52:58 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-08-14 20:52:58 +0100
commit07ee59246c2f67249882e74c4c131004aad9a6da (patch)
tree787e369b4827d3cf6ee6544b42fcf8da573236bc /gcc
parent07fd852ff115a133d7ddc27a430435126f111234 (diff)
downloadgcc-07ee59246c2f67249882e74c4c131004aad9a6da.zip
gcc-07ee59246c2f67249882e74c4c131004aad9a6da.tar.gz
gcc-07ee59246c2f67249882e74c4c131004aad9a6da.tar.bz2
PR c++/91436 fix C++ dialect for std::make_unique fix-it hint
The std::make_unique function wasn't added until C++14, and neither was the std::complex_literals namespace. gcc/cp: PR c++/91436 * name-lookup.c (get_std_name_hint): Fix min_dialect field for complex_literals and make_unique entries. gcc/testsuite: PR c++/91436 * g++.dg/lookup/missing-std-include-5.C: Limit test to C++14 and up. * g++.dg/lookup/missing-std-include-6.C: Don't check make_unique in test that runs for C++11. * g++.dg/lookup/missing-std-include-8.C: Check make_unique here. From-SVN: r274492
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c4
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/lookup/missing-std-include-5.C1
-rw-r--r--gcc/testsuite/g++.dg/lookup/missing-std-include-6.C9
-rw-r--r--gcc/testsuite/g++.dg/lookup/missing-std-include-8.C9
6 files changed, 26 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8fee045..9eeba3d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/91436
+ * name-lookup.c (get_std_name_hint): Fix min_dialect field for
+ complex_literals and make_unique entries.
+
2019-08-14 Jakub Jelinek <jakub@redhat.com>
Marek Polacek <polacek@redhat.com>
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index d5e491e..16c7428 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5559,7 +5559,7 @@ get_std_name_hint (const char *name)
{"bitset", "<bitset>", cxx11},
/* <complex>. */
{"complex", "<complex>", cxx98},
- {"complex_literals", "<complex>", cxx98},
+ {"complex_literals", "<complex>", cxx14},
/* <condition_variable>. */
{"condition_variable", "<condition_variable>", cxx11},
{"condition_variable_any", "<condition_variable>", cxx11},
@@ -5632,7 +5632,7 @@ get_std_name_hint (const char *name)
{"allocator", "<memory>", cxx98},
{"allocator_traits", "<memory>", cxx11},
{"make_shared", "<memory>", cxx11},
- {"make_unique", "<memory>", cxx11},
+ {"make_unique", "<memory>", cxx14},
{"shared_ptr", "<memory>", cxx11},
{"unique_ptr", "<memory>", cxx11},
{"weak_ptr", "<memory>", cxx11},
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d7a3e6b..33a9fc6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-08-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/91436
+ * g++.dg/lookup/missing-std-include-5.C: Limit test to C++14 and up.
+ * g++.dg/lookup/missing-std-include-6.C: Don't check make_unique in
+ test that runs for C++11.
+ * g++.dg/lookup/missing-std-include-8.C: Check make_unique here.
+
2019-08-14 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.c-torture/execute/noinit-attribute.c: Fix typo.
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C
index fe880a6..3ec9abd 100644
--- a/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-5.C
@@ -1,2 +1,3 @@
+// { dg-do compile { target c++14 } }
using namespace std::complex_literals; // { dg-error "" }
// { dg-message "#include <complex>" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C
index d9eeb42..a8f2747 100644
--- a/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-6.C
@@ -11,15 +11,6 @@ void test_make_shared ()
// { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 }
}
-template<class T>
-void test_make_unique ()
-{
- auto p = std::make_unique<T>(); // { dg-error "'make_unique' is not a member of 'std'" }
- // { dg-message "'#include <memory>'" "" { target *-*-* } .-1 }
- // { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 }
- // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 }
-}
-
std::shared_ptr<int> test_shared_ptr; // { dg-error "'shared_ptr' in namespace 'std' does not name a template type" }
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
index 68b2082..73532c8 100644
--- a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
@@ -13,6 +13,15 @@ void test_make_shared ()
// { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 }
}
+template<class T>
+void test_make_unique ()
+{
+ std::make_unique<T>(); // { dg-error "'make_unique' is not a member of 'std'" }
+ // { dg-message "'std::make_unique' is only available from C\\+\\+14 onwards" "" { target *-*-* } .-1 }
+ // { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 }
+ // { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 }
+}
+
void test_array ()
{
std::array a; // { dg-error "'array' is not a member of 'std'" }