summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/Wclass-memaccess-2.C61
-rw-r--r--gcc/testsuite/g++.dg/asan/function-argument-1.C31
-rw-r--r--gcc/testsuite/g++.dg/asan/function-argument-2.C24
-rw-r--r--gcc/testsuite/g++.dg/asan/function-argument-3.C28
-rw-r--r--gcc/testsuite/g++.dg/asan/pr81021.C33
-rw-r--r--gcc/testsuite/g++.dg/asan/pr81340.C22
-rw-r--r--gcc/testsuite/g++.dg/concepts/memfun-err.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto1.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-call4.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype9.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/forw_enum9.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept30.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/trailing14.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C27
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C42
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction40.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction41.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction42.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp1.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp13.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp14.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp18.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp19.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp21.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp22.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp23.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp24.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp25.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp26.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp28.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp3.C62
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp30.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp4.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp5.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp6.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp7.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp8.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C234
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/dr393.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C23
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C23
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/friend1.C8
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr79300.C44
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/variadic1.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/anon-struct6.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/mvc2.C1
-rw-r--r--gcc/testsuite/g++.dg/ext/mvc3.C1
-rw-r--r--gcc/testsuite/g++.dg/gomp/udr-3.C12
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr81261.C31
-rw-r--r--gcc/testsuite/g++.dg/lookup/decl1.C13
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-c-redecl.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/missing-std-include-2.C55
-rw-r--r--gcc/testsuite/g++.dg/lookup/missing-std-include-3.C35
-rw-r--r--gcc/testsuite/g++.dg/lookup/pr81229.C7
-rw-r--r--gcc/testsuite/g++.dg/opt/pr79659.C5
-rw-r--r--gcc/testsuite/g++.dg/other/i386-9.C1
-rw-r--r--gcc/testsuite/g++.dg/other/pr28432.C6
-rw-r--r--gcc/testsuite/g++.dg/overload/error1.C2
-rw-r--r--gcc/testsuite/g++.dg/overload/error2.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/catch2.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/crash12.C9
-rw-r--r--gcc/testsuite/g++.dg/parse/enum3.C6
-rw-r--r--gcc/testsuite/g++.dg/parse/operator6.C5
-rw-r--r--gcc/testsuite/g++.dg/parse/pr81247-a.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/pr81247-b.C14
-rw-r--r--gcc/testsuite/g++.dg/parse/pr81247-c.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/template-keyword1.C3
-rw-r--r--gcc/testsuite/g++.dg/plugin/decl-plugin-test.C2
-rw-r--r--gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C110
-rw-r--r--gcc/testsuite/g++.dg/pr69667.C2
-rw-r--r--gcc/testsuite/g++.dg/pr71294.C2
-rw-r--r--gcc/testsuite/g++.dg/pr81194.C60
-rw-r--r--gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C27
-rw-r--r--gcc/testsuite/g++.dg/template/crash69.C5
-rw-r--r--gcc/testsuite/g++.dg/template/duplicate1.C2
-rw-r--r--gcc/testsuite/g++.dg/template/error27.C5
-rw-r--r--gcc/testsuite/g++.dg/template/error28.C5
-rw-r--r--gcc/testsuite/g++.dg/template/lookup10.C12
-rw-r--r--gcc/testsuite/g++.dg/template/lookup11.C11
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend6.C21
-rw-r--r--gcc/testsuite/g++.dg/template/partial-specialization8.C19
-rw-r--r--gcc/testsuite/g++.dg/template/template-keyword1.C15
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81249.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81365.C39
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81462.C17
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr81408.C92
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr81209.C21
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr81262.C14
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr81530.C6
-rw-r--r--gcc/testsuite/g++.dg/vect/pr61171.cc23
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C13
-rw-r--r--gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsign-compare-2.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsign-compare-4.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsign-compare-6.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/compare1.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C20
-rw-r--r--gcc/testsuite/g++.dg/warn/pr12242.C14
108 files changed, 1633 insertions, 289 deletions
diff --git a/gcc/testsuite/g++.dg/Wclass-memaccess-2.C b/gcc/testsuite/g++.dg/Wclass-memaccess-2.C
new file mode 100644
index 00000000000..49581df1204
--- /dev/null
+++ b/gcc/testsuite/g++.dg/Wclass-memaccess-2.C
@@ -0,0 +1,61 @@
+// PR c++/81169 - -Wclass-memaccess illegitimate warning related to volatile
+// { dg-do compile }
+// { dg-options "-Wclass-memaccess" }
+
+struct S { int x; };
+
+void cast_const (const S *p)
+{
+ __builtin_memset (const_cast<S*>(p), 0, sizeof *p);
+}
+
+void cast_volatile (volatile S *p)
+{
+ __builtin_memset (const_cast<S*>(p), 0, sizeof *p);
+}
+
+void cast_const_volatile (const volatile S *p)
+{
+ __builtin_memset (const_cast<S*>(p), 0, sizeof *p);
+}
+
+void c_cast_const_volatile (const volatile S *p)
+{
+ __builtin_memset ((S*)p, 0, sizeof *p);
+}
+
+// A C cast to void* suppresses the warning because it casts away
+// the qualifiers from the otherwise trivial pointed-to type..
+void c_void_cast_const_volatile (const volatile S *p)
+{
+ __builtin_memset ((void*)p, 0, sizeof *p);
+}
+
+// Also verify that casting to char* suppresses the warning for
+// non-trivial types.
+
+struct NonTrivial
+{
+ NonTrivial ();
+ NonTrivial (const NonTrivial&);
+ NonTrivial& operator= (const NonTrivial&);
+ ~NonTrivial ();
+};
+
+void cast_void (NonTrivial *p)
+{
+ __builtin_memset (reinterpret_cast<char*>(p), 0, sizeof *p);
+}
+
+// A C cast to a character (or any trivial) type suppresses the warning.
+void c_cast_uchar (NonTrivial *p)
+{
+ __builtin_memset ((unsigned char*)p, 0, sizeof *p);
+}
+
+// A cast to void* does not suppress the warning. That is (or can be)
+// considered a feature.
+void c_cast_void (NonTrivial *p)
+{
+ __builtin_memset ((void*)p, 0, sizeof *p); // { dg-warning "\\\[-Wclass-memaccess]" }
+}
diff --git a/gcc/testsuite/g++.dg/asan/function-argument-1.C b/gcc/testsuite/g++.dg/asan/function-argument-1.C
new file mode 100644
index 00000000000..bdbb37a44a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/function-argument-1.C
@@ -0,0 +1,31 @@
+// { dg-do run }
+// { dg-shouldfail "asan" }
+// { dg-options "-fsanitize=address -fno-sanitize-address-use-after-scope" }
+
+struct A
+{
+ int a[5];
+};
+
+static __attribute__ ((noinline)) int
+goo (A *a)
+{
+ int *ptr = &a->a[0];
+ return *(volatile int *) (ptr - 1);
+}
+
+__attribute__ ((noinline)) int
+foo (A arg)
+{
+ return goo (&arg);
+}
+
+int
+main ()
+{
+ return foo (A ());
+}
+
+// { dg-output "ERROR: AddressSanitizer: stack-buffer-underflow on address.*(\n|\r\n|\r)" }
+// { dg-output "READ of size . at.*" }
+// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* underflows this variable.*" }
diff --git a/gcc/testsuite/g++.dg/asan/function-argument-2.C b/gcc/testsuite/g++.dg/asan/function-argument-2.C
new file mode 100644
index 00000000000..3a7c33bdaaa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/function-argument-2.C
@@ -0,0 +1,24 @@
+// { dg-do run }
+// { dg-shouldfail "asan" }
+
+static __attribute__ ((noinline)) int
+goo (int *a)
+{
+ return *(volatile int *)a;
+}
+
+__attribute__ ((noinline)) int
+foo (char arg)
+{
+ return goo ((int *)&arg);
+}
+
+int
+main ()
+{
+ return foo (12);
+}
+
+// { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" }
+// { dg-output "READ of size . at.*" }
+// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* partially overflows this variable.*" }
diff --git a/gcc/testsuite/g++.dg/asan/function-argument-3.C b/gcc/testsuite/g++.dg/asan/function-argument-3.C
new file mode 100644
index 00000000000..6994b6df1c8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/function-argument-3.C
@@ -0,0 +1,28 @@
+// { dg-do run }
+// { dg-shouldfail "asan" }
+// { dg-additional-options "-Wno-psabi" }
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+static __attribute__ ((noinline)) int
+goo (v4si *a)
+{
+ return (*(volatile v4si *) (a + 1))[2];
+}
+
+__attribute__ ((noinline)) int
+foo (v4si arg)
+{
+ return goo (&arg);
+}
+
+int
+main ()
+{
+ v4si v = {1,2,3,4};
+ return foo (v);
+}
+
+// { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" }
+// { dg-output "READ of size . at.*" }
+// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* overflows this variable.*" }
diff --git a/gcc/testsuite/g++.dg/asan/pr81021.C b/gcc/testsuite/g++.dg/asan/pr81021.C
new file mode 100644
index 00000000000..daa0525c273
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr81021.C
@@ -0,0 +1,33 @@
+// { dg-do run }
+
+#include <string>
+
+struct ConfigFile {
+ ConfigFile(std::string filename, std::string delimiter) { throw "error"; }
+ ConfigFile(std::string filename) {}
+};
+
+struct Configuration {
+ ConfigFile _configFile;
+
+ Configuration(const std::string &root, const char *baseName)
+ : _configFile(root + baseName, "=") { }
+ Configuration(const std::string &root, const char *a, const char *b)
+ : _configFile(root + a + b) { }
+};
+
+
+void test() {
+ std::string root("etc");
+ try {
+ Configuration config(root, "notthere");
+ }
+ catch (...) {
+ // exception is thrown, caught here and ignored...
+ }
+ Configuration config(root, "a", "b"); // ASAN error during constructor here
+}
+
+int main(int argc, const char *argv[]) {
+ test();
+}
diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C
new file mode 100644
index 00000000000..76ac08a9a56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr81340.C
@@ -0,0 +1,22 @@
+// { dg-options "-fsanitize=address -O2 -g -Wno-write-strings" }
+
+class a {
+ struct b {
+ b(int, int);
+ } c;
+
+public:
+ int d;
+ a(char *) : c(0, d) {}
+};
+class e {
+ int 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) {
+ g::h()->i("", &j);
+}
diff --git a/gcc/testsuite/g++.dg/concepts/memfun-err.C b/gcc/testsuite/g++.dg/concepts/memfun-err.C
index e44273ca8c8..f44610a6aa0 100644
--- a/gcc/testsuite/g++.dg/concepts/memfun-err.C
+++ b/gcc/testsuite/g++.dg/concepts/memfun-err.C
@@ -15,16 +15,16 @@ int called = 0;
// Test constrained member definitions
template<typename T>
- struct S1 {
+ struct S1 { // { dg-message "defined here" }
void f1() requires C<T>() { }
void g1() requires C<T>() and true;
template<C U> void h1(U u) { called = 1; }
- void g2() requires C<T>(); // { dg-error "candidate" }
+ void g2() requires C<T>(); // { dg-message "candidate" }
};
template<typename T>
- void S1<T>::g2() requires D<T>() { } // { dg-error "prototype" }
+ void S1<T>::g2() requires D<T>() { } // { dg-error "no declaration matches" }
int main() {
S1<X> sx;
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C
new file mode 100644
index 00000000000..6bf9b7b1666
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C
@@ -0,0 +1,16 @@
+// PR c++/72764
+// { dg-do compile { target c++11 } }
+
+template < typename > struct A;
+template < typename > struct B {};
+
+template < typename T >
+using C = typename A < T >::template D < T >;
+
+template < typename T > struct A
+{
+ // should be: template < typename > struct D : B < C < T > > {};
+ struct D : B < C < T > > {}; // { dg-error "not a class template" }
+};
+
+A < int >::D a; // { dg-message "required" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto1.C b/gcc/testsuite/g++.dg/cpp0x/auto1.C
index b8d39051821..dd8f5fc8cf9 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto1.C
@@ -1,9 +1,14 @@
// { dg-do compile { target c++11 } }
-// { dg-options "-std=c++98 -Wc++11-compat" }
+// { dg-options "-std=c++98 -Wc++11-compat -fdiagnostics-show-caret" }
// Test warning for use of auto in C++98 mode with C++11
// compatibility warnings
void f()
{
- auto int x = 5; // { dg-warning "changes meaning" }
+ auto int x = 5; /* { dg-warning "changes meaning" }
+ { dg-begin-multiline-output "" }
+ auto int x = 5;
+ ^~~~
+ ----
+ { dg-end-multiline-output "" } */
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C
new file mode 100644
index 00000000000..d504954bc63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C
@@ -0,0 +1,13 @@
+// PR c++/81188
+// { dg-do compile { target c++11 } }
+
+template <class F>
+struct C {
+ F fast(long i) const;
+ auto operator[](long i) const -> decltype(this->fast(i));
+};
+
+template <class F>
+auto C<F>::operator[](long i) const -> decltype(this->fast(i)) {
+ return fast(i);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype9.C b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
index 9db3db039a2..45cd9ed7da3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
@@ -1,9 +1,9 @@
// PR c++/34271
// { dg-do compile { target c++11 } }
-template<int> struct A
-{
+template<int> struct A { // { dg-message "defined here" }
static int i;
};
-template<int N> int A<N>::i(decltype (A::i)); // { dg-error "member function|must be an expression" }
+template<int N> int A<N>::i(decltype (A::i)); // { dg-error "no declaration" }
+// { dg-message "no functions" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
index 4f1475acfde..acf16c6c8bd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
@@ -4,7 +4,7 @@
template<typename T> struct S1
{
enum E1 : int;
- enum class E2 : int;
+ enum class E2 : T;
};
template<typename T> enum S1<T>::E1 : int { e1 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C
new file mode 100644
index 00000000000..90a06c610f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C
@@ -0,0 +1,7 @@
+// PR c++/81164
+// { dg-do compile { target c++11 } }
+
+struct A {};
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : B,C { using A::A; }; // { dg-error "indirect" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C
new file mode 100644
index 00000000000..8e31f739d74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C
@@ -0,0 +1,23 @@
+// PR c++/67054
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ A(int) {}
+};
+
+struct C
+{
+ C(int) {}
+};
+
+struct B : A
+{
+ using A::A;
+ C c = 42;
+};
+
+int main()
+{
+ B b = 24;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
index 8cbeed66047..c5a00750236 100644
--- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
@@ -8,7 +8,7 @@ struct B2 {
B2(int);
};
struct D1 : B1, B2 {
- using B1::B1; // { dg-error "inherited" }
+ using B1::B1; // { dg-message "declared" }
using B2::B2; // { dg-error "inherited" }
}; // ill-formed: attempts to declare D1(int) twice
struct D2 : B1, B2 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C
new file mode 100644
index 00000000000..57111fdef6a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C
@@ -0,0 +1,12 @@
+// PR c++/71570
+// { dg-do compile { target c++11 } }
+
+void foo (int);
+
+void foo (void)
+{
+ [&foo] // { dg-error "cannot capture" }
+ {
+ foo (0);
+ };
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
new file mode 100644
index 00000000000..8e803c82f24
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
@@ -0,0 +1,28 @@
+/* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+
+/* { dg-options "-fdiagnostics-generate-patch" } */
+
+// { dg-do compile { target c++11 } }
+
+void test (int i)
+{
+ auto a = { &i }; // { dg-error "deducing from brace-enclosed initializer list requires #include <initializer_list>" }
+}
+
+/* Verify the output from -fdiagnostics-generate-patch.
+ We expect the patch to begin with a header, containing this
+ source filename, via an absolute path.
+ Given the path, we can only capture it via regexps. */
+/* { dg-regexp "\\-\\-\\- .*" } */
+/* { dg-regexp "\\+\\+\\+ .*" } */
+/* Use #if 0/#endif rather than comments, to allow the text to contain
+ a comment. */
+#if 0
+{ dg-begin-multiline-output "" }
+@@ -1,3 +1,4 @@
++#include <initializer_list>
+ /* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+{ dg-end-multiline-output "" }
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept30.C b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C
new file mode 100644
index 00000000000..c51e94e7573
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C
@@ -0,0 +1,12 @@
+// PR c++/69300
+// { dg-do compile { target c++11 } }
+
+template<typename A>
+struct F {
+ template<typename B>
+ void f() noexcept(&F::template f<B>) {} // { dg-error "exception specification" }
+};
+
+int main () {
+ F<void>().f<int>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing14.C b/gcc/testsuite/g++.dg/cpp0x/trailing14.C
new file mode 100644
index 00000000000..2544d0bab5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing14.C
@@ -0,0 +1,15 @@
+// PR c++/65775
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wignored-qualifiers" }
+
+using Qi = int const volatile;
+Qi q1(); // { dg-warning "1: type qualifiers ignored" }
+auto q2() -> Qi; // { dg-warning "1: type qualifiers ignored" }
+
+using Fi = int();
+Fi f1(); // { dg-error "1: 'f1' declared as function returning a function" }
+auto f2() -> Fi; // { dg-error "1: 'f2' declared as function returning a function" }
+
+using Ai = int[5];
+Ai a1(); // { dg-error "1: 'a1' declared as function returning an array" }
+auto a2() -> Ai; // { dg-error "1: 'a2' declared as function returning an array" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C
new file mode 100644
index 00000000000..4a02ab22990
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++11 } }
+
+template <class A0, class... As> struct tuple
+{
+ tuple<As...> tail;
+ template <int Offset, class... More> int apply(const More&... more) {
+ return tail.apply<1>(more...); // { dg-error "" } needs .template
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C
new file mode 100644
index 00000000000..6f8df3e1aaf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C
@@ -0,0 +1,22 @@
+// PR c++/72801
+// { dg-do compile { target c++11 } }
+
+template < typename, typename > struct A {};
+
+template < typename ... T > struct B
+{
+ template < typename > struct C
+ {
+ static const int a = 0;
+ };
+
+ template < typename R, typename ... S >
+ struct C < R (A < T, S > ...) >
+ {
+ static const int a = 1;
+ };
+};
+
+#define SA(X) static_assert ((X), #X)
+SA(B <>::C<int()>::a == 1);
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C
new file mode 100644
index 00000000000..0dbe904601d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C
@@ -0,0 +1,16 @@
+// PR c++/81215
+// { dg-do compile { target c++11 } }
+
+template<typename U> struct X { };
+template<typename T, typename U = void> struct set { };
+
+template <typename V, template <typename...> class C>
+void bar (const X<C<V>>&)
+{
+}
+
+void
+foo (X<set<int>>& x)
+{
+ bar (x);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C
new file mode 100644
index 00000000000..f3e576ae988
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C
@@ -0,0 +1,27 @@
+// PR c++/69111
+// { dg-do compile { target c++11 } }
+
+template <template <typename> class ...>
+struct template_list {};
+
+template <typename T>
+struct A
+{};
+
+template <typename>
+struct B
+{
+ template <typename T>
+ using type = A<T>;
+};
+
+template <typename ... Types>
+struct C
+{
+ using type = template_list<B<Types>::template type...>;
+};
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C b/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C
new file mode 100644
index 00000000000..680ba633611
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C
@@ -0,0 +1,42 @@
+// { dg-do run }
+
+#include <string.h>
+
+const char *ct, *dt, *cv;
+
+struct KLASS
+{
+ KLASS () ;
+ ~KLASS ();
+ operator int ();
+};
+
+KLASS::KLASS()
+{
+ ct = __builtin_FUNCTION ();
+}
+
+KLASS::~KLASS ()
+{
+ dt = __builtin_FUNCTION ();
+}
+
+KLASS::operator int ()
+{
+ cv = __builtin_FUNCTION ();
+ return 0;
+}
+
+int main ()
+{
+ int q = int (KLASS ());
+
+ if (strcmp (ct, "KLASS"))
+ return 1;
+ if (strcmp (dt, "~KLASS"))
+ return 2;
+ if (strcmp (cv, "operator int"))
+ return 3;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C
new file mode 100644
index 00000000000..eeffa69adf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C
@@ -0,0 +1,19 @@
+// PR c++/81180
+// { dg-options -std=c++1z }
+
+template < int I > struct int_{};
+
+template < typename T >
+struct A{
+ template < typename U, int I >
+ struct B{
+ B(U u, int_< I >){}
+ };
+};
+
+
+int main(){
+ A< int >::B v(0, int_< 0 >());
+ (void)v;
+}
+
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C
new file mode 100644
index 00000000000..5e7fa3a2c51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C
@@ -0,0 +1,19 @@
+// { dg-options -std=c++1z }
+
+#include <initializer_list>
+
+struct B { };
+
+template <class T>
+struct A
+{
+ A(std::initializer_list<T>);
+ A(T, B);
+};
+
+A a { 1, B() };
+
+template <class,class> struct same;
+template <class T> struct same<T,T> { };
+
+same<decltype(a), A<int>> s;
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C
new file mode 100644
index 00000000000..8217fd4d79a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C
@@ -0,0 +1,19 @@
+// { dg-options -std=c++1z }
+
+#include <initializer_list>
+
+template <class,class> struct same;
+template <class T> struct same<T,T> { };
+
+template <class T>
+struct A
+{
+ A(const A&);
+ A(std::initializer_list<T>);
+};
+
+A a { 1 };
+A b { a };
+
+same<decltype (a), decltype (b)> s;
+
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp1.C b/gcc/testsuite/g++.dg/cpp1z/decomp1.C
index 98f60905e1a..33068917863 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp1.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp1.C
@@ -7,10 +7,10 @@ struct S { int a; signed char b; float c; } s = { 6, 7, 8.0f };
int
main ()
{
- auto & [ c, d ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ e, f ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ g, h, i ] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ j, k, l ] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto & [ c, d ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ e, f ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ g, h, i ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ j, k, l ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
c++;
d++;
e += 6;
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp13.C b/gcc/testsuite/g++.dg/cpp1z/decomp13.C
index 9ebddc6e608..a9bf264a2ca 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp13.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp13.C
@@ -11,27 +11,27 @@ namespace std {
template<> struct std::tuple_size<B> { static constexpr int value = 2; };
template<int I> struct std::tuple_element<I,B> { typedef int type; };
-auto [ aa, bb, cc, dd ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+auto [ aa, bb, cc, dd ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZDC2aa2bb2cc2ddE" } }
-const auto & [ e, f, g, h ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+const auto & [ e, f, g, h ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZDC1e1f1g1hE" } }
-auto [ ee, ff ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+auto [ ee, ff ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZDC2ee2ffE" } }
-auto & [ gg, hh ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+auto & [ gg, hh ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZDC2gg2hhE" } }
namespace N
{
namespace M
{
- auto [ i, j, k, l ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ i, j, k, l ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZN1N1MDC1i1j1k1lEE" } }
- auto & [ m, n, o, ppp ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto & [ m, n, o, ppp ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZN1N1MDC1m1n1o3pppEE" } }
- auto [ ii, jj ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ ii, jj ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZN1N1MDC2ii2jjEE" } }
// { dg-final { scan-assembler "_ZN1N1M2iiE" } }
// { dg-final { scan-assembler "_ZN1N1M2jjE" } }
- auto & [ mm, nn ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto & [ mm, nn ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZN1N1MDC2mm2nnEE" } }
// { dg-final { scan-assembler "_ZN1N1M2mmE" } }
// { dg-final { scan-assembler "_ZN1N1M2nnE" } }
@@ -39,14 +39,14 @@ namespace N
}
namespace std
{
- auto [ i2, j2, k2, l2 ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ i2, j2, k2, l2 ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZStDC2i22j22k22l2E" } }
- auto [ vv, ww ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ vv, ww ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
// { dg-final { scan-assembler "_ZStDC2vv2wwE" } }
// { dg-final { scan-assembler "_ZSt2vv" } }
// { dg-final { scan-assembler "_ZSt2ww" } }
}
namespace
{
- auto [ v, w, x, y ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ v, w, x, y ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp14.C b/gcc/testsuite/g++.dg/cpp1z/decomp14.C
index 5d6d05fb8a4..d05a8903232 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp14.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp14.C
@@ -18,13 +18,13 @@ struct M : virtual J, L {};
void
foo (C &c, F &f, G &g, H &h, I &i, K &k, M &m)
{
- auto [ ci ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [ ci ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
auto [ fi ] = f; // { dg-error "cannot decompose class type 'F': both it and its base class 'A' have non-static data members" }
- // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
auto [ gi ] = g; // { dg-error "cannot decompose class type 'G': its base classes 'A' and 'E' have non-static data members" }
- // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
- auto [ hi ] = h; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ auto [ hi ] = h; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
auto [ ki ] = k; // { dg-error "'B' is an ambiguous base of 'K'" }
- // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
- auto [ mi ] = m; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+ auto [ mi ] = m; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp18.C b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
index d5c68a26891..7799e462cdd 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp18.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
@@ -7,6 +7,6 @@ void
foo ()
{
int z = 0;
- for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
z += b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s;
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp19.C b/gcc/testsuite/g++.dg/cpp1z/decomp19.C
index e392e658e27..e7d7abfce7c 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp19.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp19.C
@@ -8,6 +8,6 @@ main ()
int x = 99;
struct S { int &x; };
S s{x};
- auto [p] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [p] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
return p - 99;
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp2.C b/gcc/testsuite/g++.dg/cpp1z/decomp2.C
index 5831fc74940..6574028217f 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp2.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp2.C
@@ -9,12 +9,12 @@ __complex__ int c = 7 + 8i;
int
main ()
{
- auto & [ d, e, f, g ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ h, i, j, k ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ l, m ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ n, o ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ p, q ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ r, s ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto & [ d, e, f, g ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ h, i, j, k ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ l, m ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ n, o ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ p, q ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ r, s ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
d += 10;
e += 11;
f += 12;
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp21.C b/gcc/testsuite/g++.dg/cpp1z/decomp21.C
index d046ed54a14..7d3a465d3a3 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp21.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp21.C
@@ -12,5 +12,6 @@ foo ()
auto [ n, o, p ] { a };
auto [ q, r, t ] ( s );
auto [ u, v, w ] ( s, ); // { dg-error "expected primary-expression before '.' token" }
- auto [ x, y, z ] ( a ); // { dg-error "expression list treated as compound expression in initializer" "" { target *-*-* } .-1 }
+ // { dg-error "invalid initializer for structured binding declaration" "" { target *-*-* } .-1 }
+ auto [ x, y, z ] ( a );
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp22.C b/gcc/testsuite/g++.dg/cpp1z/decomp22.C
index 81d40c56931..9e6b8df486a 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp22.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp22.C
@@ -16,6 +16,6 @@ int &&get (C<E...> &&);
int
foo (C<int> t)
{
- auto[x0] = t; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto[x0] = t; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
return x0;
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp23.C b/gcc/testsuite/g++.dg/cpp1z/decomp23.C
index c682fa00264..9e9278050c9 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp23.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp23.C
@@ -7,6 +7,6 @@
int
foo (std::tuple<int> t)
{
- auto [x0] = t; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [x0] = t; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
return x0;
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp24.C b/gcc/testsuite/g++.dg/cpp1z/decomp24.C
index 0e874fa6055..4bd519791ff 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp24.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp24.C
@@ -7,5 +7,5 @@ foo ()
{
int a {10};
auto [b] { [&a](){} }; // { dg-error "cannot decompose lambda closure type" }
- return b - a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
+ return b - a; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp25.C b/gcc/testsuite/g++.dg/cpp1z/decomp25.C
index c99273613bc..d90e665add0 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp25.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp25.C
@@ -7,9 +7,9 @@ struct S
{
enum E { A };
void f () { auto [x] = 0; x++; } // { dg-error "cannot decompose non-array non-class type" }
- // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
void g (T t) { auto [y] = t; y++; } // { dg-error "cannot decompose non-array non-class type" }
-}; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
+}; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
int
main ()
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp26.C b/gcc/testsuite/g++.dg/cpp1z/decomp26.C
index f413920f545..035433385d7 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp26.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp26.C
@@ -2,5 +2,5 @@
// { dg-do compile { target c++11 } }
// { dg-options "" }
-template<typename T> T &make(); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .+1 }
+template<typename T> T &make(); // { dg-warning "structured bindings only available with" "" { target c++14_down } .+1 }
auto [d1, d2] = make<int>(); // { dg-error "cannot decompose non-array non-class type" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp28.C b/gcc/testsuite/g++.dg/cpp1z/decomp28.C
index 7561d9dfc02..8b0b5a54999 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp28.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp28.C
@@ -15,14 +15,14 @@ template <int N>
void
foo (std::tuple<int> b)
{
- auto [c] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [c] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
}
template <typename T>
void
bar (std::tuple<T> b)
{
- auto [c] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [c] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
}
void
@@ -35,5 +35,5 @@ baz (std::tuple<int> b)
int
main ()
{
- [](auto) { [](std::tuple<int> b) { auto[c] = b; }; } (0); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ [](auto) { [](std::tuple<int> b) { auto[c] = b; }; } (0); // { dg-warning "structured bindings only available with" "" { target c++14_down } }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp3.C b/gcc/testsuite/g++.dg/cpp1z/decomp3.C
index a739d3ace37..58ce71bf6ac 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp3.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp3.C
@@ -9,36 +9,36 @@ B baz ();
void
test (A &b, B c)
{
- int && [ d ] = c; // { dg-error "decomposition declaration cannot be declared with type 'int'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- char & [ e, f, ff ] { b }; // { dg-error "decomposition declaration cannot be declared with type 'char'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto&[g,h,i]=b; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
- decltype (auto) [ j ] = c; // { dg-error "decomposition declaration cannot be declared with type 'decltype.auto.'" "" { target c++14 } }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ int && [ d ] = c; // { dg-error "structured binding declaration cannot have type 'int'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ char & [ e, f, ff ] { b }; // { dg-error "structured binding declaration cannot have type 'char'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto&[g,h,i]=b; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
+ decltype (auto) [ j ] = c; // { dg-error "structured binding declaration cannot have type 'decltype.auto.'" "" { target c++14 } }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
// { dg-error "expected primary-expression before 'decltype'" "" { target c++11_down } .-2 }
auto & & && & [ m, n, o ] = b; // { dg-error "multiple ref-qualifiers" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- constexpr auto [ p ] = c; // { dg-error "decomposition declaration cannot be declared 'constexpr'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ constexpr auto [ p ] = c; // { dg-error "structured binding declaration cannot be 'constexpr'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
friend auto [ q ] = c; // { dg-error "'friend' used outside of class" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- typedef auto [ r ] = c; // { dg-error "decomposition declaration cannot be declared 'typedef'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- inline auto [ s ] = c; // { dg-error "decomposition declaration cannot be declared 'inline'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ typedef auto [ r ] = c; // { dg-error "structured binding declaration cannot be 'typedef'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ inline auto [ s ] = c; // { dg-error "structured binding declaration cannot be 'inline'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
__restrict auto [ t ] = c; // { dg-error "invalid use of 'restrict'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- long long auto [ u ] = c; // { dg-error "'long long' invalid for 'decomposition'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ long long auto [ u ] = c; // { dg-error "'long long' invalid for 'structured binding'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
virtual auto [ v ] = c; // { dg-error "'virtual' outside class declaration" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
explicit auto [ w ] = c; // { dg-error "'explicit' outside class declaration" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- static auto [ x ] = c; // { dg-error "decomposition declaration cannot be declared 'static'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- extern auto [ y ] { c }; // { dg-error "decomposition declaration cannot be declared 'extern'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ static auto [ x ] = c; // { dg-error "structured binding declaration cannot be 'static'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ extern auto [ y ] { c }; // { dg-error "structured binding declaration cannot be 'extern'" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
}
void
@@ -52,15 +52,15 @@ void
test3 (A &b, B c)
{
auto [ d, e, f ] = arr; // { dg-error "only 3 names provided while 'int .4.' decomposes into 4 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided while 'int .4.' decomposes into 4 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ l, m ] = b; // { dg-error "only 2 names provided while 'A' decomposes into 3 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto & [ n, o, p, q ] = b; // { dg-error "4 names provided while 'A' decomposes into 3 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [] { c }; // { dg-error "empty decomposition declaration" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [] { c }; // { dg-error "empty structured binding declaration" }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ r, s ] = c; // { dg-error "2 names provided while 'B' decomposes into 1 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp30.C b/gcc/testsuite/g++.dg/cpp1z/decomp30.C
new file mode 100644
index 00000000000..23115ad1082
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp30.C
@@ -0,0 +1,12 @@
+// PR c++/81258
+// { dg-options -std=c++1z }
+
+int a[2];
+auto [b, c] (a);
+auto [d, e] { a };
+auto [f, g] = a;
+auto [h, i] ( a, a ); // { dg-error "invalid initializer for structured binding declaration" }
+auto [j, k] { a, a }; // { dg-error "invalid initializer for structured binding declaration" }
+auto [l, m] = { a }; // { dg-error "deducing from brace-enclosed initializer list requires" }
+auto [n, o] {}; // { dg-error "invalid initializer for structured binding declaration" }
+auto [p, q] (); // { dg-error "invalid initializer for structured binding declaration" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp4.C b/gcc/testsuite/g++.dg/cpp1z/decomp4.C
index bc85263e986..55460833bd9 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp4.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp4.C
@@ -15,18 +15,18 @@ void
test (A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h, I &i)
{
auto [ j ] = a; // { dg-error "cannot decompose class type 'A' because it has an anonymous struct member" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ k ] { b }; // { dg-error "cannot decompose class type 'B' because it has an anonymous union member" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ l, l2 ] = c; // { dg-error "cannot decompose non-public member 'C::b' of 'C'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ m ] = d; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [ m ] = d; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
auto [ n ] { e }; // { dg-error "cannot decompose non-public member 'E::a' of 'E'" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ o ] { f }; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [ o ] { f }; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
auto & [ p ] { g }; // { dg-error "cannot decompose class type 'G': both it and its base class 'F' have non-static data members" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ q ] { h }; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [ q ] { h }; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
auto [ r ] { i }; // { dg-error "cannot decompose class type 'I': its base classes 'F' and 'H' have non-static data members" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp5.C b/gcc/testsuite/g++.dg/cpp1z/decomp5.C
index 86b2c22f37a..99610d76832 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp5.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp5.C
@@ -12,19 +12,19 @@ main ()
x.i = i;
x.j = 2 * i++;
}
- for (auto & [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto & [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x += 2;
y += 3;
}
i = 0;
- for (const auto [ u, v ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (const auto [ u, v ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
if (u != i + 2 || v != 2 * i++ + 3)
__builtin_abort ();
}
i = 0;
- for (auto [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x += 4;
y += 5;
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp6.C b/gcc/testsuite/g++.dg/cpp1z/decomp6.C
index 7a8a239d9e1..378a25141f4 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp6.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp6.C
@@ -23,7 +23,7 @@ main ()
if (ccnt != 6 || dcnt || cccnt || tccnt)
__builtin_abort ();
{
- auto [b,c,d,e,f,g] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [b,c,d,e,f,g] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 6 || dcnt || cccnt || tccnt != 6)
__builtin_abort ();
b.a++;
@@ -34,7 +34,7 @@ main ()
if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5])
__builtin_abort ();
{
- auto&[ h, i, j, k, l, m ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto&[ h, i, j, k, l, m ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 6 || dcnt || cccnt || tccnt != 6)
__builtin_abort ();
j.a += 4;
@@ -59,7 +59,7 @@ main ()
if (ccnt != 12 || dcnt != 12 || cccnt || tccnt != 6)
__builtin_abort ();
{
- auto [b,c,d,e,f,g] { a }; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [b,c,d,e,f,g] { a }; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 12 || dcnt != 12 || cccnt != 6 || tccnt != 6)
__builtin_abort ();
b.a++;
@@ -70,7 +70,7 @@ main ()
if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5])
__builtin_abort ();
{
- auto&[ h, i, j, k, l, m ] {a}; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto&[ h, i, j, k, l, m ] {a}; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 12 || dcnt != 12 || cccnt != 6 || tccnt != 6)
__builtin_abort ();
j.a += 4;
@@ -95,7 +95,7 @@ main ()
if (ccnt != 18 || dcnt != 24 || cccnt != 6 || tccnt != 6)
__builtin_abort ();
{
- auto [b,c,d,e,f,g] ( a ); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto [b,c,d,e,f,g] ( a ); // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 18 || dcnt != 24 || cccnt != 12 || tccnt != 6)
__builtin_abort ();
b.a++;
@@ -106,7 +106,7 @@ main ()
if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5])
__builtin_abort ();
{
- auto&[ h, i, j, k, l, m ] (a); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto&[ h, i, j, k, l, m ] (a); // { dg-warning "structured bindings only available with" "" { target c++14_down } }
if (ccnt != 18 || dcnt != 24 || cccnt != 12 || tccnt != 6)
__builtin_abort ();
j.a += 4;
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp7.C b/gcc/testsuite/g++.dg/cpp1z/decomp7.C
index d366adecc4c..545c5cf1060 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp7.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp7.C
@@ -10,14 +10,14 @@ template <typename T, typename U>
void
foo (T &x, U &y)
{
- auto & [ c, d ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ e, f ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ g, h, i ] = sa; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ j, k, l ] = sa; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ m, n ] = x; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ o, p ] = x; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto [ q, r, s ] = y; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
- auto & [ t, u, v ] = y; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ auto & [ c, d ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ e, f ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ g, h, i ] = sa; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ j, k, l ] = sa; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ m, n ] = x; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ o, p ] = x; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto [ q, r, s ] = y; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ auto & [ t, u, v ] = y; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
c += 1;
e += 2;
g += 3;
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp8.C b/gcc/testsuite/g++.dg/cpp1z/decomp8.C
index 9e1ea5d5da1..af3075cce98 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp8.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp8.C
@@ -14,19 +14,19 @@ foo (T &b)
x.i = i;
x.j = 2 * i++;
}
- for (auto & [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto & [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x += 2;
y += 3;
}
i = 0;
- for (const auto [ u, v ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (const auto [ u, v ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
if (u != i + 2 || v != 2 * i++ + 3)
__builtin_abort ();
}
i = 0;
- for (auto [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x += 4;
y += 5;
@@ -45,19 +45,19 @@ foo (T &b)
x.i = i;
x.j = 2 * i++;
}
- for (auto & [ x, y ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto & [ x, y ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x -= 2;
y -= 3;
}
i = 0;
- for (const auto [ u, v ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (const auto [ u, v ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
if (u != i - 2 || v != 2 * i++ - 3)
__builtin_abort ();
}
i = 0;
- for (auto [ x, y ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ for (auto [ x, y ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } }
{
x -= 4;
y -= 5;
diff --git a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C
index 11269ccbe9c..b473ed553c9 100644
--- a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C
+++ b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C
@@ -17,121 +17,121 @@ void bar (E);
void
foo ()
{
- A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" }
+ B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
C c1 { s };
- D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" }
- D d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } }
- // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 }
- D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } }
- D d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } }
+ D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" }
+ D d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } }
+ // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 }
+ D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } }
+ D d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } }
D d5 { D(l) };
- D d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } }
- E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
+ D d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } }
+ E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" }
- C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" }
+ C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
- D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } }
- E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } }
+ E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" }
- bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" }
- V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" }
+ bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" }
+ V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" }
- if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" }
+ if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
;
- if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } }
+ if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } }
; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 }
- C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } }
- B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } }
- B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } }
+ B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } }
+ B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
// { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 }
- C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 }
- C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } }
- C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } }
+ C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
}
struct U
{
- U () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
- U (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ U () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
+ U (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
U (float) : e({ 6 }) {}// { dg-error "list-initializer for non-class type must not be parenthesized" }
- // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target *-*-* } .-1 }
+ // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target *-*-* } .-1 }
E e;
};
struct W
{
- A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
- C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } }
+ A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" }
+ B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
+ C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-1 }
- D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" }
+ D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" }
};
template <int N>
void
foo2 ()
{
- A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" }
+ B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
C c1 { s };
- D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" }
- D d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } }
- // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 }
- D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } }
- D d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } }
+ D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" }
+ D d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } }
+ // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 }
+ D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } }
+ D d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } }
D d5 { D(l) };
- D d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } }
- E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
+ D d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } }
+ E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" }
- C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
- D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } }
- E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" }
+ C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
+ D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } }
+ E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" }
- bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" }
- V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" }
+ bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" }
+ V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" }
- if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" }
+ if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
;
- if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } }
+ if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } }
; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 }
- C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } }
- B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } }
- B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } }
+ B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } }
+ B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
// { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 }
- C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 }
- C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } }
- C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } }
+ C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
}
template <int N>
struct U2
{
- U2 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
- U2 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ U2 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
+ U2 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
U2 (float) : e({ 6 }) {}
E e;
@@ -140,11 +140,11 @@ struct U2
template <int N>
struct W2
{
- A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" "" { target *-*-* } .-2 }
- B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-3 }
- C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-4 }
+ A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" "" { target *-*-* } .-2 }
+ B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-3 }
+ C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-4 }
// { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-5 }
- D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-6 }
+ D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-6 }
};
template <typename H, typename I, typename J, typename K, typename L, typename M>
@@ -152,54 +152,54 @@ void
foo3 ()
{
void bar3 (L);
- H a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- I b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ H a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" }
+ I b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
J c1 { s };
- K d1 { K(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" }
- K d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } }
- // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 }
- K d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } }
- K d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } }
+ K d1 { K(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" }
+ K d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } }
+ // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 }
+ K d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } }
+ K d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } }
K d5 { K(l) };
- K d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } }
- L e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- L e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
+ K d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } }
+ L e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ L e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- L e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ L e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- L e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ L e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- I b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" }
- J c2 = { J { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
- K *d7 = new K { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } }
- L *e5 = new L { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ I b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" }
+ J c2 = { J { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
+ K *d7 = new K { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } }
+ L *e5 = new L { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 }
- bar3 ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" }
- bar3 (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- M v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" }
- M v2 = { L { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } }
- M v3 = { L { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } }
+ bar3 ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" }
+ bar3 (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ M v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" }
+ M v2 = { L { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } }
+ M v3 = { L { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
- M v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" }
- if (I b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ M v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" }
+ if (I b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
;
- if (I b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } }
+ if (I b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } }
; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 }
- J c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } }
- I b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } }
- I b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } }
+ J c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } }
+ I b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } }
+ I b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } }
// { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 }
- J c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ J c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 }
- J c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } }
- J c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } }
+ J c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } }
+ J c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } }
}
template <typename L>
struct U3
{
- U3 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
- U3 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } }
+ U3 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
+ U3 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } }
// { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 }
U3 (float) : e({ 6 }) {}
L e;
@@ -208,11 +208,11 @@ struct U3
template <typename H, typename I, typename J, typename K>
struct W3
{
- H a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" "" { target *-*-* } .-2 }
- I b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-3 }
- J c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-4 }
+ H a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" "" { target *-*-* } .-2 }
+ I b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-3 }
+ J c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-4 }
// { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-5 }
- K d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-6 }
+ K d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-6 }
};
void
@@ -221,17 +221,17 @@ test ()
foo2<0> ();
U2<0> u20;
U2<1> u21 (5);
- W2<0> w2; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-1 }
- // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-2 }
+ W2<0> w2; // { dg-error "invalid conversion from 'int' to 'A'" }
+ // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-1 }
+ // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-2 }
// { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-3 }
- // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-4 }
+ // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-4 }
foo3<A, B, C, D, E, V> ();
U3<E> u30;
U3<E> u31 (5);
- W3<A, B, C, D> w3; // { dg-error "invalid conversion from 'int' to 'A {enum}'" }
- // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-1 }
- // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-2 }
+ W3<A, B, C, D> w3; // { dg-error "invalid conversion from 'int' to 'A'" }
+ // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-1 }
+ // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-2 }
// { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-3 }
- // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-4 }
+ // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-4 }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/dr393.C b/gcc/testsuite/g++.dg/cpp1z/dr393.C
new file mode 100644
index 00000000000..4a7645a618f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/dr393.C
@@ -0,0 +1,4 @@
+// DR 393
+// { dg-options -Wpedantic }
+
+void f(int (&)[]); // { dg-warning "unknown bound" "" { target c++14_down } }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C
new file mode 100644
index 00000000000..cae380a21eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C
@@ -0,0 +1,23 @@
+// { dg-options "-O2 -gdwarf-4 -dA -gno-strict-dwarf" }
+// { dg-final { scan-assembler-times " DW_AT_export_symbols" 1 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" 2 } }
+
+namespace A
+{
+ int i = 5;
+ inline namespace B
+ {
+ int j = 6;
+ namespace C
+ {
+ int k = 7;
+ };
+ };
+};
+int l = A::i + A::j + A::C::k;
+int m = A::i + A::B::j + A::B::C::k;
+namespace
+{
+ int n = 8;
+};
+int o = n;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C
new file mode 100644
index 00000000000..4d9aed7e219
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C
@@ -0,0 +1,23 @@
+// { dg-options "-O2 -gdwarf-5 -dA" }
+// { dg-final { scan-assembler-times " DW_AT_export_symbols" 2 } }
+// { dg-final { scan-assembler-not "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" } }
+
+namespace A
+{
+ int i = 5;
+ inline namespace B
+ {
+ int j = 6;
+ namespace C
+ {
+ int k = 7;
+ };
+ };
+};
+int l = A::i + A::j + A::C::k;
+int m = A::i + A::B::j + A::B::C::k;
+namespace
+{
+ int n = 8;
+};
+int o = n;
diff --git a/gcc/testsuite/g++.dg/diagnostic/friend1.C b/gcc/testsuite/g++.dg/diagnostic/friend1.C
new file mode 100644
index 00000000000..a35f92ad949
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/friend1.C
@@ -0,0 +1,8 @@
+// { dg-options "-fdiagnostics-show-caret" }
+
+friend void foo(); /* { dg-error "used outside of class" }
+ { dg-begin-multiline-output "" }
+ friend void foo();
+ ^~~~~~
+ ------
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr79300.C b/gcc/testsuite/g++.dg/diagnostic/pr79300.C
new file mode 100644
index 00000000000..6805e85873f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr79300.C
@@ -0,0 +1,44 @@
+// { dg-options "-fdiagnostics-show-caret" }
+
+#define TEST_1_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_1_DEPTH_0 }
+
+void test_1 ()
+{
+ TEST_1_DEPTH_0 // { dg-line use_TEST_1_DEPTH_0 }
+}
+
+// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_1_DEPTH_0 }
+/* { dg-begin-multiline-output "" }
+ #define TEST_1_DEPTH_0 throw bad_alloc;
+ ^~~~~~~~~
+ { dg-end-multiline-output "" } */
+// { dg-message "in expansion of macro 'TEST_1_DEPTH_0'" "" { target *-*-* } use_TEST_1_DEPTH_0 }
+/* { dg-begin-multiline-output "" }
+ TEST_1_DEPTH_0
+ ^~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+
+
+#define TEST_2_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_2_DEPTH_0 }
+#define TEST_2_DEPTH_1 TEST_2_DEPTH_0 // { dg-line define_TEST_2_DEPTH_1 }
+
+void test_2 ()
+{
+ TEST_2_DEPTH_1 // { dg-line use_TEST_2_DEPTH_1 }
+}
+
+// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_2_DEPTH_0 }
+/* { dg-begin-multiline-output "" }
+ #define TEST_2_DEPTH_0 throw bad_alloc;
+ ^~~~~~~~~
+ { dg-end-multiline-output "" } */
+// { dg-message "in expansion of macro 'TEST_2_DEPTH_0'" "" { target *-*-* } define_TEST_2_DEPTH_1 }
+/* { dg-begin-multiline-output "" }
+ #define TEST_2_DEPTH_1 TEST_2_DEPTH_0
+ ^~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+// { dg-message "in expansion of macro 'TEST_2_DEPTH_1'" "" { target *-*-* } use_TEST_2_DEPTH_1 }
+/* { dg-begin-multiline-output "" }
+ TEST_2_DEPTH_1
+ ^~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/g++.dg/diagnostic/variadic1.C b/gcc/testsuite/g++.dg/diagnostic/variadic1.C
index 69f1f988f30..7e3db314328 100644
--- a/gcc/testsuite/g++.dg/diagnostic/variadic1.C
+++ b/gcc/testsuite/g++.dg/diagnostic/variadic1.C
@@ -4,6 +4,6 @@
template<int N> struct B { };
template<typename... T> struct A
{
- B<sizeof...(T)> f(); // { dg-error "sizeof\\.\\.\\." }
+ B<sizeof...(T)> f(); // { dg-message "sizeof\\.\\.\\." }
B<42> f(); // { dg-error "cannot be overloaded" }
};
diff --git a/gcc/testsuite/g++.dg/ext/anon-struct6.C b/gcc/testsuite/g++.dg/ext/anon-struct6.C
index 66d4b327196..9b59085f670 100644
--- a/gcc/testsuite/g++.dg/ext/anon-struct6.C
+++ b/gcc/testsuite/g++.dg/ext/anon-struct6.C
@@ -3,8 +3,8 @@
struct A
{
struct
- { // { dg-error "anonymous struct cannot have function members" }
+ {
struct { static int i; }; // { dg-error "prohibits anonymous structs|non-static data members|unnamed class" }
- void foo() { i; }
+ void foo() { i; } // { dg-error "can only have non-static data" }
}; // { dg-error "prohibits anonymous structs" }
};
diff --git a/gcc/testsuite/g++.dg/ext/mvc2.C b/gcc/testsuite/g++.dg/ext/mvc2.C
index e7abab81d95..1b8c6f4d6e9 100644
--- a/gcc/testsuite/g++.dg/ext/mvc2.C
+++ b/gcc/testsuite/g++.dg/ext/mvc2.C
@@ -1,4 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-ifunc "" } */
__attribute__((target_clones("avx","arch=slm","default")))
__attribute__((target("avx")))
diff --git a/gcc/testsuite/g++.dg/ext/mvc3.C b/gcc/testsuite/g++.dg/ext/mvc3.C
index 05bebf7d4fb..d32b2c93aa0 100644
--- a/gcc/testsuite/g++.dg/ext/mvc3.C
+++ b/gcc/testsuite/g++.dg/ext/mvc3.C
@@ -1,4 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-ifunc "" } */
__attribute__((target("avx")))
__attribute__((target_clones("avx","arch=slm","default")))
diff --git a/gcc/testsuite/g++.dg/gomp/udr-3.C b/gcc/testsuite/g++.dg/gomp/udr-3.C
index 9fc6f40820a..57531f2042b 100644
--- a/gcc/testsuite/g++.dg/gomp/udr-3.C
+++ b/gcc/testsuite/g++.dg/gomp/udr-3.C
@@ -77,7 +77,7 @@ namespace N2
{
struct U
{
- #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
};
}
@@ -109,9 +109,9 @@ namespace N4
struct U
{
#pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
- #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
- #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
+ #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
#pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (bar: short int: omp_out += omp_in)
@@ -132,7 +132,7 @@ namespace N5
template <typename T>
struct U
{
- #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: T: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
};
U<S> u;
@@ -159,9 +159,9 @@ namespace N6
{
typedef V V2;
#pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
- #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: V2: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
- #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
+ #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
#pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (bar: short int: omp_out += omp_in)
diff --git a/gcc/testsuite/g++.dg/ipa/pr81261.C b/gcc/testsuite/g++.dg/ipa/pr81261.C
new file mode 100644
index 00000000000..f182eb152cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr81261.C
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-guess-branch-probability" } */
+
+struct CBase {
+ virtual void BaseFunc () {}
+};
+
+struct MMixin {
+ virtual void * MixinFunc (int, void *) = 0;
+};
+
+struct CExample: CBase, public MMixin
+{
+ void *MixinFunc (int arg, void *arg2)
+ {
+ if (arg != 1 || arg2)
+ return 0;
+ return this;
+ }
+};
+
+void *test (MMixin & anExample)
+{
+ return anExample.MixinFunc (1, 0);
+}
+
+int main ()
+{
+ CExample c;
+ return (test (c) != &c);
+}
diff --git a/gcc/testsuite/g++.dg/lookup/decl1.C b/gcc/testsuite/g++.dg/lookup/decl1.C
index 42a9978e597..205ffcff1d7 100644
--- a/gcc/testsuite/g++.dg/lookup/decl1.C
+++ b/gcc/testsuite/g++.dg/lookup/decl1.C
@@ -19,14 +19,13 @@ C2<X>::operator C1<Y>()
return C1<Y>();
}
-struct A
-{
- operator int (); // { dg-error "operator" }
- operator float (); // { dg-error "operator" }
- operator float () const; // { dg-error "operator" }
- template <typename T> operator T * (); // { dg-error "candidates" }
+struct A { // { dg-message "defined here" }
+ operator int (); // { dg-message "operator" }
+ operator float (); // { dg-message "operator" }
+ operator float () const; // { dg-message "operator" }
+ template <typename T> operator T * (); // { dg-message "operator" }
};
-A::operator short () { // { dg-error "prototype for" }
+A::operator short () { // { dg-error "no declaration matches" }
return 0;
}
diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
index 31d100a74f9..3e901cc7759 100644
--- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
+++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
@@ -8,4 +8,4 @@ namespace A {
// next line should trigger an error because
// it conflicts with previous declaration of foo_func (), due to
// different exception specifications.
-extern "C" void foo_func (); // { dg-error "C language|exception specifications" }
+extern "C" void foo_func (); // { dg-error "C language linkage|exception specifications" }
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C
new file mode 100644
index 00000000000..ae918f869a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C
@@ -0,0 +1,55 @@
+/* Example of fix-it hints that add #include directives,
+ adding them after a pre-existing #include. */
+
+/* { dg-options "-fdiagnostics-generate-patch" } */
+
+/* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+
+#include <stdio.h>
+
+void test (void)
+{
+ std::string s ("hello world"); // { dg-error ".string. is not a member of .std." }
+ // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 }
+
+ std::cout << 10; // { dg-error ".cout. is not a member of .std." }
+ // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 }
+}
+
+/* Same again, to test idempotency of the added "#include" fix-it. */
+
+void test_2 (void)
+{
+ std::string s ("hello again"); // { dg-error ".string. is not a member of .std." }
+ // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 }
+
+ std::cout << 10; // { dg-error ".cout. is not a member of .std." }
+ // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 }
+}
+
+/* Verify the output from -fdiagnostics-generate-patch.
+ We expect the patch to begin with a header, containing this
+ source filename, via an absolute path.
+ Given the path, we can only capture it via regexps. */
+/* { dg-regexp "\\-\\-\\- .*" } */
+/* { dg-regexp "\\+\\+\\+ .*" } */
+
+/* Verify the hunks within the patch.
+ Use #if 0/#endif rather than comments, to allow the text to contain
+ a comment.
+ We expect a "#include <string>" and "#include <iostream>" to each have been
+ added once, immediately below the last #include. */
+#if 0
+{ dg-begin-multiline-output "" }
+@@ -7,6 +7,8 @@
+ directives). */
+
+ #include <stdio.h>
++#include <string>
++#include <iostream>
+
+ void test (void)
+ {
+{ dg-end-multiline-output "" }
+#endif
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C
new file mode 100644
index 00000000000..23f868dff09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C
@@ -0,0 +1,35 @@
+/* Example of where the error occurs before the first #include,
+ which in this case happens to be the missing header.
+ For this case, expect to insert the #include at the top of the file. */
+
+/* { dg-options "-fdiagnostics-generate-patch" } */
+
+void test ()
+{
+ std::string test; // { dg-error ".string. is not a member of .std." }
+ // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 }
+}
+
+#include <string>
+
+/* Verify the output from -fdiagnostics-generate-patch.
+ We expect the patch to begin with a header, containing this
+ source filename, via an absolute path.
+ Given the path, we can only capture it via regexps. */
+/* { dg-regexp "\\-\\-\\- .*" } */
+/* { dg-regexp "\\+\\+\\+ .*" } */
+
+/* Verify the hunks within the patch.
+ Use #if 0/#endif rather than comments, to allow the text to contain
+ a comment.
+ We expect a "#include <string>" have been added once, at the top
+ of the file. */
+#if 0
+{ dg-begin-multiline-output "" }
+@@ -1,3 +1,4 @@
++#include <string>
+ /* Example of where the error occurs before the first #include,
+ which in this case happens to be the missing header.
+ For this case, expect to insert the #include at the top of the file. */
+{ dg-end-multiline-output "" }
+#endif
diff --git a/gcc/testsuite/g++.dg/lookup/pr81229.C b/gcc/testsuite/g++.dg/lookup/pr81229.C
new file mode 100644
index 00000000000..c9981c9f60a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/pr81229.C
@@ -0,0 +1,7 @@
+// PR c++/81229 GC ICE with stale pointed in identifier type.
+// { dg-additional-options "--param ggc-min-heapsize=0" }
+
+typedef unsigned L;
+typedef unsigned L;
+
+L l;
diff --git a/gcc/testsuite/g++.dg/opt/pr79659.C b/gcc/testsuite/g++.dg/opt/pr79659.C
new file mode 100644
index 00000000000..132d5c1e7f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr79659.C
@@ -0,0 +1,5 @@
+// PR target/79659
+// { dg-do compile }
+// { dg-options "-flifetime-dse=123456" }
+
+// { dg-error "is not between 0 and 2" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/g++.dg/other/i386-9.C b/gcc/testsuite/g++.dg/other/i386-9.C
index 79640579142..782cf875eef 100644
--- a/gcc/testsuite/g++.dg/other/i386-9.C
+++ b/gcc/testsuite/g++.dg/other/i386-9.C
@@ -2,6 +2,7 @@
// Testcase by Zdenek Sojka <zsojka@seznam.cz>
// { dg-do run { target i?86-*-* x86_64-*-* } }
+/* { dg-require-stack-check "" } */
// { dg-options "-Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer" }
int main()
diff --git a/gcc/testsuite/g++.dg/other/pr28432.C b/gcc/testsuite/g++.dg/other/pr28432.C
index 2b9c7634367..8e2428594d9 100644
--- a/gcc/testsuite/g++.dg/other/pr28432.C
+++ b/gcc/testsuite/g++.dg/other/pr28432.C
@@ -3,5 +3,7 @@
// { dg-options "" }
-struct A {};
-void A::foo(); // { dg-error "member function declared in class|outside of class is not definition" }
+struct A {}; // { dg-message "defined here" }
+
+void A::foo(); // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/overload/error1.C b/gcc/testsuite/g++.dg/overload/error1.C
index 6c5998c720a..a4fd4854eb2 100644
--- a/gcc/testsuite/g++.dg/overload/error1.C
+++ b/gcc/testsuite/g++.dg/overload/error1.C
@@ -2,6 +2,6 @@
struct S
{
- void f () {} // { dg-error "with" }
+ void f () {} // { dg-message "previous" }
int f () { return 0; } // { dg-error "overloaded" }
};
diff --git a/gcc/testsuite/g++.dg/overload/error2.C b/gcc/testsuite/g++.dg/overload/error2.C
index 4a9d35bc49d..23a2ea18d3a 100644
--- a/gcc/testsuite/g++.dg/overload/error2.C
+++ b/gcc/testsuite/g++.dg/overload/error2.C
@@ -6,6 +6,6 @@
struct A
{
- void foo(); // { dg-error "with" }
+ void foo(); // { dg-message "previous" }
virtual void foo(); // { dg-error "cannot be overloaded" }
};
diff --git a/gcc/testsuite/g++.dg/parse/catch2.C b/gcc/testsuite/g++.dg/parse/catch2.C
new file mode 100644
index 00000000000..528d6c74125
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/catch2.C
@@ -0,0 +1,4 @@
+// PR c++/62046
+
+void foo() { } catch (...); // { dg-error "expected" }
+class bar { void foo() { } catch (...); }; // { dg-error "expected" }
diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C
index 769ca2e9343..61921fded8f 100644
--- a/gcc/testsuite/g++.dg/parse/crash12.C
+++ b/gcc/testsuite/g++.dg/parse/crash12.C
@@ -6,15 +6,16 @@
template <class _Tp> class auto_ptr {};
template <class _Tp>
-class counted_ptr
-{
+class counted_ptr { // { dg-message "defined here" }
public:
- counted_ptr(::auto_ptr<_Tp>& __a); // { dg-error "candidate" }
+ counted_ptr(::auto_ptr<_Tp>& __a); // { dg-message "candidate" }
::auto_ptr<_Tp> auto_ptr();
};
template <class _Tp>
-inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required|not match|template" }
+inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a)
+// { dg-error "no declaration matches" "" { target *-*-* } .-1 }
+// { dg-error "template argument required" "" { target *-*-* } .-2 }
{
}
diff --git a/gcc/testsuite/g++.dg/parse/enum3.C b/gcc/testsuite/g++.dg/parse/enum3.C
index dc07193d389..81e69635678 100644
--- a/gcc/testsuite/g++.dg/parse/enum3.C
+++ b/gcc/testsuite/g++.dg/parse/enum3.C
@@ -1,5 +1,7 @@
// PR c++/28261
-struct A {}; // { dg-error "A::A" }
+struct A {}; // { dg-message "A::A" }
+// { dg-message "defined here" "" { target *-*-* } .-1 }
-A::A (enum { e }) {} // { dg-error "defined|prototype" }
+A::A (enum { e }) {} // { dg-error "no declaration matches" }
+// { dg-error "in parameter types" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/parse/operator6.C b/gcc/testsuite/g++.dg/parse/operator6.C
index e58a3a682c3..c13860efd80 100644
--- a/gcc/testsuite/g++.dg/parse/operator6.C
+++ b/gcc/testsuite/g++.dg/parse/operator6.C
@@ -1,5 +1,6 @@
// PR c++/25635
-struct A {};
+struct A {}; // { dg-message "defined here" }
-A::operator int(); // { dg-error "class" }
+A::operator int(); // { dg-error "no declaration matches" }
+// { dg-message "no conversion operators" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/parse/pr81247-a.C b/gcc/testsuite/g++.dg/parse/pr81247-a.C
new file mode 100644
index 00000000000..c5b22ab479f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr81247-a.C
@@ -0,0 +1,13 @@
+// PR c++/81247 ICE
+
+namespace N // { dg-message "previous declaration" }
+// { dg-error "expected" "" { target *-*-* } .+1 }
+template < typename T > class A
+{ // { dg-error "redeclared as different" }
+ template < T > friend class N;
+};
+
+void f ()
+{
+ A < int > a1; // { dg-message "required from here" }
+}
diff --git a/gcc/testsuite/g++.dg/parse/pr81247-b.C b/gcc/testsuite/g++.dg/parse/pr81247-b.C
new file mode 100644
index 00000000000..b2b035b9baf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr81247-b.C
@@ -0,0 +1,14 @@
+// PR c++/81247 confused error
+
+namespace N { // { dg-message "previous declaration" }
+}
+
+template < typename T > class A
+{ // { dg-error "redeclared as different" }
+ template < T > friend class N;
+};
+
+void f ()
+{
+ A < int > a1;
+}
diff --git a/gcc/testsuite/g++.dg/parse/pr81247-c.C b/gcc/testsuite/g++.dg/parse/pr81247-c.C
new file mode 100644
index 00000000000..32f41f28f41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr81247-c.C
@@ -0,0 +1,13 @@
+// PR c++/81247 confused error
+
+namespace N { // { dg-message "previous declaration" }
+ template < typename T > class A
+ { // { dg-error "conflicts with a previous" }
+ template < T > friend class N;
+ };
+}
+
+void f ()
+{
+ N::A < int > a1;
+}
diff --git a/gcc/testsuite/g++.dg/parse/template-keyword1.C b/gcc/testsuite/g++.dg/parse/template-keyword1.C
new file mode 100644
index 00000000000..0a1298e75f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template-keyword1.C
@@ -0,0 +1,3 @@
+// PR c++/81257
+
+template < typename ::template A < int > >; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C b/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
index 08a2ff2aa5d..e6bd746892c 100644
--- a/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
+++ b/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
@@ -17,7 +17,7 @@ class test_class {
int class_field1; // { dg-warning "Decl Field class_field1" }
int class_field2; // { dg-warning "Decl Field class_field2" }
- test_class() // { dg-warning "Decl Function test_class" }
+ test_class() // { dg-warning "Decl Function __ct" }
: class_field1(0), class_field2(0)
{}
diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
index 2c004f30620..a145dfea28c 100644
--- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
+++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
@@ -848,3 +848,113 @@ tests::test_method_calls ()
~~~~~~~~~~~~~~~~~~^~
{ dg-end-multiline-output "" } */
}
+
+namespace std
+{
+ class type_info { public: int foo; };
+}
+
+void test_typeid (int i)
+{
+ __emit_expression_range (0, &typeid(i)); /* { dg-warning "range" } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, &typeid(i));
+ ^~~~~~~~~~
+ { dg-end-multiline-output "" } */
+
+ __emit_expression_range (0, &typeid(int)); /* { dg-warning "range" } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, &typeid(int));
+ ^~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+
+ __emit_expression_range (0, &typeid(i * 2)); /* { dg-warning "range" } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, &typeid(i * 2));
+ ^~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+
+ __emit_expression_range (0, typeid(int).foo); /* { dg-warning "range" } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, typeid(int).foo);
+ ~~~~~~~~~~~~^~~
+ { dg-end-multiline-output "" } */
+}
+
+/* Various tests of locations involving macros. */
+
+void test_within_macro_1 (int lhs, int rhs)
+{
+#define MACRO_1(EXPR) EXPR
+
+ __emit_expression_range (0, MACRO_1 (lhs == rhs));
+
+/* { dg-warning "range" "" { target *-*-* } .-2 } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, MACRO_1 (lhs == rhs));
+ ~~~~^~~~~~
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO_1(EXPR) EXPR
+ ^~~~
+ { dg-end-multiline-output "" } */
+
+#undef MACRO_1
+}
+
+void test_within_macro_2 (int lhs, int rhs)
+{
+#define MACRO_2(EXPR) EXPR
+
+ __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs)));
+
+/* { dg-warning "range" "" { target *-*-* } .-2 } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs)));
+ ~~~~^~~~~~
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs)));
+ ^~~~~~~
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO_2(EXPR) EXPR
+ ^~~~
+ { dg-end-multiline-output "" } */
+
+#undef MACRO_2
+}
+
+void test_within_macro_3 (int lhs, int rhs)
+{
+#define MACRO_3(EXPR) EXPR
+
+ __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs));
+
+/* { dg-warning "range" "" { target *-*-* } .-2 } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs));
+ ^
+ { dg-end-multiline-output "" } */
+
+#undef MACRO_3
+}
+
+void test_within_macro_4 (int lhs, int rhs)
+{
+#define MACRO_4(EXPR) EXPR
+
+ __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs)));
+
+/* { dg-warning "range" "" { target *-*-* } .-2 } */
+/* { dg-begin-multiline-output "" }
+ __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs)));
+ ^
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO_4(EXPR) EXPR
+ ^~~~
+ { dg-end-multiline-output "" } */
+
+#undef MACRO_4
+}
diff --git a/gcc/testsuite/g++.dg/pr69667.C b/gcc/testsuite/g++.dg/pr69667.C
index 2b3e93d2e1e..76f7cb3d40b 100644
--- a/gcc/testsuite/g++.dg/pr69667.C
+++ b/gcc/testsuite/g++.dg/pr69667.C
@@ -2,7 +2,7 @@
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
-/* { dg-options "-mcpu=power8 -w -std=c++14 -mlra" } */
+/* { dg-options "-mcpu=power8 -w -std=c++14" } */
/* target/69667, compiler got
internal compiler error: Max. number of generated reload insns per insn is achieved (90) */
diff --git a/gcc/testsuite/g++.dg/pr71294.C b/gcc/testsuite/g++.dg/pr71294.C
index 55dd01e5ccf..67675dd7e30 100644
--- a/gcc/testsuite/g++.dg/pr71294.C
+++ b/gcc/testsuite/g++.dg/pr71294.C
@@ -1,7 +1,7 @@
// { dg-do compile { target { powerpc64*-*-* && lp64 } } }
// { dg-require-effective-target powerpc_p8vector_ok } */
// { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } }
-// { dg-options "-mcpu=power8 -O3 -fstack-protector -mno-lra" }
+// { dg-options "-mcpu=power8 -O3 -fstack-protector" }
// PAR target/71294 failed because RELOAD could not figure how create a V2DI
// vector that auto vectorization created with each element being the same
diff --git a/gcc/testsuite/g++.dg/pr81194.C b/gcc/testsuite/g++.dg/pr81194.C
new file mode 100644
index 00000000000..249fcf3b7c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr81194.C
@@ -0,0 +1,60 @@
+// { dg-do compile }
+// { dg-options "-O2 -std=c++17 -fno-exceptions" }
+
+template <class a> struct b { typedef a *c; };
+class e {};
+template <typename a> class d {
+public:
+ typedef typename b<a>::c c;
+ c begin();
+ c end();
+};
+struct f {
+ enum { g } h;
+};
+struct i {
+ d<f *> j();
+};
+struct l {
+ d<i *> k();
+};
+class ac;
+class o {
+public:
+ o(int *, int *, int *, ac *);
+};
+class ac {
+public:
+ ac(e);
+ virtual o *ae(int *, int *, int *, int *);
+};
+class p {
+ void af(f *m) {
+ switch (m->h)
+ case f::g:
+ ag();
+ }
+
+public:
+ void n() {
+ l ah;
+ for (i *ai : ah.k())
+ for (f *m : ai->j())
+ af(m);
+ }
+ virtual void ag() { __builtin_unreachable(); }
+};
+template <typename = int> class an : o {
+public:
+ an(int *, int *, int *, int *, ac *);
+};
+class q : ac {
+public:
+ q() : ac([]() -> e {}()) {}
+ o *ae(int *ap, int *aq, int *ar, int *as) { an(ap, aq, ar, as, this); }
+};
+template <typename at>
+an<at>::an(int *, int *aq, int *ar, int *as, ac *au) : o(aq, ar, as, au) {
+ p().n();
+}
+void av() { new q; }
diff --git a/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C b/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C
new file mode 100644
index 00000000000..937c38f11a2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C
@@ -0,0 +1,27 @@
+/* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+
+/* { dg-options "-fdiagnostics-generate-patch" } */
+
+void test()
+{
+ typeid(void); // { dg-error "must '#include <typeinfo>' before using 'typeid'" }
+}
+
+/* Verify the output from -fdiagnostics-generate-patch.
+ We expect the patch to begin with a header, containing this
+ source filename, via an absolute path.
+ Given the path, we can only capture it via regexps. */
+/* { dg-regexp "\\-\\-\\- .*" } */
+/* { dg-regexp "\\+\\+\\+ .*" } */
+/* Use #if 0/#endif rather than comments, to allow the text to contain
+ a comment. */
+#if 0
+{ dg-begin-multiline-output "" }
+@@ -1,3 +1,4 @@
++#include <typeinfo>
+ /* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+
+{ dg-end-multiline-output "" }
+#endif
diff --git a/gcc/testsuite/g++.dg/template/crash69.C b/gcc/testsuite/g++.dg/template/crash69.C
index badf70bd0e4..21ed91bb27e 100644
--- a/gcc/testsuite/g++.dg/template/crash69.C
+++ b/gcc/testsuite/g++.dg/template/crash69.C
@@ -3,10 +3,11 @@
template<typename T> class A
{
static int i; // { dg-message "private" }
- friend int T::foo(); // { dg-error "does not match" }
+ friend int T::foo(); // { dg-error "no declaration matches" }
};
struct B
{
- void foo() { A<B>::i; } // { dg-error "within|candidate" }
+ void foo() { A<B>::i; } // { dg-message "candidate" }
+ // { dg-error "private within" "" { target *-*-* } .-1 }
};
diff --git a/gcc/testsuite/g++.dg/template/duplicate1.C b/gcc/testsuite/g++.dg/template/duplicate1.C
index c9cdab4b932..39185b350e7 100644
--- a/gcc/testsuite/g++.dg/template/duplicate1.C
+++ b/gcc/testsuite/g++.dg/template/duplicate1.C
@@ -2,6 +2,6 @@
template<int> struct A
{
- ~A() {} // { dg-error "with" }
+ ~A() {} // { dg-message "previous" }
~A() {} // { dg-error "cannot be overloaded" }
};
diff --git a/gcc/testsuite/g++.dg/template/error27.C b/gcc/testsuite/g++.dg/template/error27.C
index 8d41d0248ef..7f15f8c284d 100644
--- a/gcc/testsuite/g++.dg/template/error27.C
+++ b/gcc/testsuite/g++.dg/template/error27.C
@@ -1,5 +1,6 @@
// PR c++/27211
-struct A {};
+struct A {}; // { dg-message "defined here" }
-template<int> void A::foo() {} // { dg-error "member function" }
+template<int> void A::foo() {} // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/error28.C b/gcc/testsuite/g++.dg/template/error28.C
index e87d542d888..d4cf031210b 100644
--- a/gcc/testsuite/g++.dg/template/error28.C
+++ b/gcc/testsuite/g++.dg/template/error28.C
@@ -1,5 +1,6 @@
// PR c++/27211
-struct A {};
+struct A {}; // { dg-message "defined here" }
-template<int> void A::foo(); // { dg-error "member function" }
+template<int> void A::foo(); // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/lookup10.C b/gcc/testsuite/g++.dg/template/lookup10.C
new file mode 100644
index 00000000000..fa90af46c7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup10.C
@@ -0,0 +1,12 @@
+// PR c++/81204
+
+namespace std {
+ template<typename, typename> struct set { };
+}
+using namespace std;
+
+template <int I, typename Result>
+inline void set(Result & res)
+{
+ res.template set<I>();
+}
diff --git a/gcc/testsuite/g++.dg/template/lookup11.C b/gcc/testsuite/g++.dg/template/lookup11.C
new file mode 100644
index 00000000000..203460eda73
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup11.C
@@ -0,0 +1,11 @@
+// PR c++/81026
+
+namespace std {
+ template<class> struct extent;
+}
+using namespace std;
+
+template <class T>
+struct S {
+ void f() { T().template extent<42>(); }
+};
diff --git a/gcc/testsuite/g++.dg/template/memfriend6.C b/gcc/testsuite/g++.dg/template/memfriend6.C
index 5f82339af54..4f126862670 100644
--- a/gcc/testsuite/g++.dg/template/memfriend6.C
+++ b/gcc/testsuite/g++.dg/template/memfriend6.C
@@ -6,18 +6,21 @@
// Member function of class template as friend
// Erroneous case: mismatch during declaration
-template <class T> struct A {
- template <class U> void f(U); // { dg-error "candidate" }
- void g(); // { dg-error "candidate|with" }
- void h(); // { dg-error "candidate|with" }
- void i(int); // { dg-error "candidate" }
+template <class T> struct A { // { dg-message "defined here" }
+ template <class U> void f(U); // { dg-message "candidate" }
+ void g(); // { dg-message "candidate" }
+ void h(); // { dg-message "candidate" }
+ void i(int); // { dg-message "candidate" }
};
class C {
int ii;
- template <class U> friend void A<U>::f(U); // { dg-error "not match" }
+ template <class U>
+ friend void A<U>::f(U); // { dg-error "no declaration matches" }
template <class U> template <class V>
- friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" }
- template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" }
- template <class U> friend void A<U>::i(char); // { dg-error "not match" }
+ friend void A<U>::g(); // { dg-error "no declaration matches" }
+ template <class U>
+ friend int A<U>::h(); // { dg-error "no declaration matches" }
+ template <class U>
+ friend void A<U>::i(char); // { dg-error "no declaration matches" }
};
diff --git a/gcc/testsuite/g++.dg/template/partial-specialization8.C b/gcc/testsuite/g++.dg/template/partial-specialization8.C
new file mode 100644
index 00000000000..e3ffe3b58a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial-specialization8.C
@@ -0,0 +1,19 @@
+// PR c++/55639
+
+template <int number>
+struct SomeClass
+{
+ SomeClass() { }
+
+ template <typename E, int number2>
+ struct Fun {
+ static void
+ fun() { }
+ };
+};
+
+template <int number>
+template <typename E>
+struct SomeClass<number>::template Fun<E, 0> { // { dg-error "template" }
+ static void fun() { }
+};
diff --git a/gcc/testsuite/g++.dg/template/template-keyword1.C b/gcc/testsuite/g++.dg/template/template-keyword1.C
new file mode 100644
index 00000000000..0f928a8523e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/template-keyword1.C
@@ -0,0 +1,15 @@
+// PR c++/45976
+
+template<int a>
+struct A {
+ static const int value;
+
+ template<int b>
+ struct B {
+ static const int value;
+ };
+};
+
+template<int a>
+template<int b>
+const int A<a>::template B<b>::value = 0; // { dg-error "keyword .template" }
diff --git a/gcc/testsuite/g++.dg/torture/pr81249.C b/gcc/testsuite/g++.dg/torture/pr81249.C
new file mode 100644
index 00000000000..7bf617b0421
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr81249.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx2 -mprefer-avx128" { target x86_64-*-* i?86-*-* } } */
+
+typedef struct rtx_def *rtx;
+union rtunion {
+ rtx rt_rtx;
+};
+struct rtx_def {
+ struct {
+ rtunion fld[0];
+ } u;
+ rtx elem[];
+} a;
+int b, c, d;
+rtx e;
+int main() {
+ for (;;) {
+ d = 0;
+ for (; d < b; d++)
+ if (a.elem[d])
+ e = a.elem[d]->u.fld[1].rt_rtx;
+ if (e)
+ c = 0;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr81365.C b/gcc/testsuite/g++.dg/torture/pr81365.C
new file mode 100644
index 00000000000..fde5e503df9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr81365.C
@@ -0,0 +1,39 @@
+// PR tree-optimization/81365
+// { dg-do run }
+
+struct A { unsigned a; };
+
+struct B {
+ B (const A *x)
+ {
+ __builtin_memcpy (b, x, 3 * sizeof (A));
+ __builtin_memcpy (c, x + 3, sizeof (A));
+ __builtin_memset (c + 1, 0, sizeof (A));
+ }
+ bool
+ foo (unsigned x)
+ {
+ A *it = c;
+ if (it->a == x || (++it)->a == x)
+ {
+ A t(b[0]);
+ b[0] = *it;
+ *it = t;
+ return true;
+ }
+ return false;
+ }
+ A b[3];
+ A c[2];
+};
+
+int
+main ()
+{
+ A x[] = { 4, 8, 12, 18 };
+ B y(x);
+ if (!y.foo (18))
+ __builtin_abort ();
+ if (!y.foo (4))
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr81462.C b/gcc/testsuite/g++.dg/torture/pr81462.C
new file mode 100644
index 00000000000..044c8b78ee5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr81462.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O1 -fno-ipa-pure-const" }
+struct B {
+ B* self;
+ B() : self( this ) { self->f(); }
+ virtual void f() = 0;
+ };
+
+ struct D : B
+ {
+ void f() {}
+ };
+
+ int main()
+ {
+ D d;
+ }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
new file mode 100644
index 00000000000..f94544b9e2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
@@ -0,0 +1,92 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */
+
+namespace a {
+void b () __attribute__ ((__noreturn__));
+template <typename> struct d;
+template <typename e> struct d<e *>
+{
+ typedef e f;
+};
+struct g
+{
+ template <typename h> using i = h *;
+};
+}
+using a::d;
+template <typename j, typename> class k
+{
+ j l;
+
+public:
+ typename d<j>::f operator* () {}
+ void operator++ () { ++l; }
+ j
+ aa ()
+ {
+ return l;
+ }
+};
+template <typename m, typename n, typename ab>
+bool
+operator!= (k<m, ab> o, k<n, ab> p2)
+{
+ return o.aa () != p2.aa ();
+}
+struct p;
+namespace a {
+struct F
+{
+ struct q
+ {
+ using ai = g::i<p>;
+ };
+ using r = q::ai;
+};
+class H
+{
+public:
+ k<F::r, int> begin ();
+ k<F::r, int> end ();
+};
+int s;
+class I
+{
+public:
+ void
+ aq (char)
+ {
+ if (s)
+ b ();
+ }
+};
+class u : public I
+{
+public:
+ void
+ operator<< (u o (u))
+ {
+ o (*this);
+ }
+ u operator<< (void *);
+};
+template <typename at, typename au>
+at
+av (au o)
+{
+ o.aq ('\n');
+}
+u ax;
+}
+struct p
+{
+ char *ay;
+};
+a::H t;
+void
+ShowHelpListCommands ()
+{
+ for (auto c : t) /* { dg-message "note: missed loop optimization: niters analysis .*" } */
+ a::ax << c.ay << a::av;
+}
+
diff --git a/gcc/testsuite/g++.dg/ubsan/pr81209.C b/gcc/testsuite/g++.dg/ubsan/pr81209.C
new file mode 100644
index 00000000000..3f2a5768907
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr81209.C
@@ -0,0 +1,21 @@
+// PR sanitizer/81209
+// { dg-do compile }
+// { dg-options "-fsanitize=undefined -fno-declone-ctor-dtor" }
+
+#ifdef __SIZEOF_INT128__
+typedef __int128 T;
+#else
+typedef long long int T;
+#endif
+
+struct B {};
+struct A : virtual public B
+{
+ A (long);
+ T a;
+};
+
+A::A (long c)
+{
+ long b = a % c;
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr81262.C b/gcc/testsuite/g++.dg/ubsan/pr81262.C
new file mode 100644
index 00000000000..1b360de95ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr81262.C
@@ -0,0 +1,14 @@
+// PR sanitizer/81262
+// { dg-do compile }
+// { dg-options "-O2 -fsanitize=unreachable" }
+
+int
+foo ()
+{
+ asm goto ("" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr81530.C b/gcc/testsuite/g++.dg/ubsan/pr81530.C
new file mode 100644
index 00000000000..e21724686c4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr81530.C
@@ -0,0 +1,6 @@
+/* PR sanitizer/81530 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined" } */
+
+int a[(long) 4e20]; /* { dg-error "overflow in constant expression" } */
+/* { dg-error "size of array .a. is too large" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/g++.dg/vect/pr61171.cc b/gcc/testsuite/g++.dg/vect/pr61171.cc
new file mode 100644
index 00000000000..f3e2e3e4c13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr61171.cc
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-require-effective-target vect_float }
+// { dg-additional-options "-ffast-math" }
+
+float px[1024];
+float xx, vv;
+unsigned int N=1024;
+
+void ok() {
+ for (unsigned j=0U; j<N; ++j) {
+ float ax = px[j]-xx;
+ vv-=ax;
+ }
+}
+
+void noOk() {
+ for (unsigned j=0U; j<N; ++j) {
+ float ax = xx-px[j];
+ vv+=ax;
+ }
+}
+
+// { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } }
diff --git a/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C
new file mode 100644
index 00000000000..afaef9ad429
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C
@@ -0,0 +1,13 @@
+// PR bootstrap/81216
+// { dg-options "-Wmultistatement-macros" }
+// { dg-do compile }
+
+template <typename A, typename B>
+static bool
+equal (A a, A b, B c)
+{
+ for (; a != b; ++a, (void)++c)
+ if (!(*a == *c))
+ return false;
+ return true;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C
new file mode 100644
index 00000000000..52607b62284
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C
@@ -0,0 +1,8 @@
+// PR c++/51270
+// { dg-options "-O2" }
+
+const int& f(long l)
+{
+ const int& i = l;
+ return i; // { dg-warning "address of local variable" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C
index 2b8360648fa..b66e8b46565 100644
--- a/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C
@@ -6,5 +6,5 @@ void
foo (__complex__ int i)
{
i == 0u;
- i == ~1u; // { dg-warning "comparison between signed and unsigned integer expressions" }
+ i == ~1u; // { dg-warning "comparison of integer expressions of different signedness" }
}
diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C
index b3eb8e2a7de..e92ab137e3b 100644
--- a/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C
+++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C
@@ -3,10 +3,10 @@
int foo(unsigned int *a, int b)
{
- return (*a) <= b; // { dg-warning "comparison between signed and unsigned" }
+ return (*a) <= b; // { dg-warning "comparison of integer expressions of different signedness" }
}
int bar(unsigned int *a, int b)
{
- return *a <= b; // { dg-warning "comparison between signed and unsigned" }
+ return *a <= b; // { dg-warning "comparison of integer expressions of different signedness" }
}
diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C
index 1f8af664c7b..71b4ebf1613 100644
--- a/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C
@@ -8,7 +8,7 @@ int main()
int i = 5;
int const ic = 5;
- i < 5u; // { dg-warning "5:comparison between signed and unsigned" }
+ i < 5u; // { dg-warning "5:comparison of integer expressions of different signedness" }
ic < 5u;
FIVE < 5u;
}
diff --git a/gcc/testsuite/g++.dg/warn/compare1.C b/gcc/testsuite/g++.dg/warn/compare1.C
index e00592262c6..38f4dffd1da 100644
--- a/gcc/testsuite/g++.dg/warn/compare1.C
+++ b/gcc/testsuite/g++.dg/warn/compare1.C
@@ -6,5 +6,5 @@
int f(unsigned a, int b)
{
- return a < b; /* { dg-warning "signed and unsigned" } */
+ return a < b; /* { dg-warning "comparison of integer expressions of different signedness" } */
}
diff --git a/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C
new file mode 100644
index 00000000000..93a42eac08d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C
@@ -0,0 +1,20 @@
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wctor-dtor-privacy" }
+
+class X // { dg-message "only defines private" }
+{
+public:
+ X (X const &); // { dg-message "requires an existing" }
+};
+
+class Y // { dg-message "only defines private" }
+{
+public:
+ Y (Y &&); // { dg-message "requires an existing" }
+};
+
+class Z
+{
+public:
+ Z (int);
+};
diff --git a/gcc/testsuite/g++.dg/warn/pr12242.C b/gcc/testsuite/g++.dg/warn/pr12242.C
index e1cd780d170..f95bf8b92d9 100644
--- a/gcc/testsuite/g++.dg/warn/pr12242.C
+++ b/gcc/testsuite/g++.dg/warn/pr12242.C
@@ -10,14 +10,14 @@ void example ()
X x;
Y y;
- x = 10; // { dg-warning "invalid conversion from .int. to .X {enum}." "invalid" }
+ x = 10; // { dg-warning "invalid conversion from .int. to .X." "invalid" }
// { dg-warning "unspecified" "unspecified" { target *-*-* } .-1 }
- x = 1; // { dg-warning "invalid conversion from .int. to .X {enum}." }
- x = C; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
- x = D; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
- y = A; // { dg-error "cannot convert .X {enum}. to .Y {enum}. in assignment" }
- x = y; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
- x = i; // { dg-warning "invalid conversion from .int. to .X {enum}." }
+ x = 1; // { dg-warning "invalid conversion from .int. to .X." }
+ x = C; // { dg-error "cannot convert .Y. to .X. in assignment" }
+ x = D; // { dg-error "cannot convert .Y. to .X. in assignment" }
+ y = A; // { dg-error "cannot convert .X. to .Y. in assignment" }
+ x = y; // { dg-error "cannot convert .Y. to .X. in assignment" }
+ x = i; // { dg-warning "invalid conversion from .int. to .X." }
}
void foo ()