diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/init')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/const10.C | 33 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/const11.C | 29 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/ctor4-1.C | 21 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/ctor4.C | 8 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/ctor8.C | 2 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/pr25811.C | 90 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/pr29043.C | 17 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/pr43719.C | 60 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C | 4 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C | 6 |
10 files changed, 187 insertions, 83 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/const10.C b/gcc-4.9/gcc/testsuite/g++.dg/init/const10.C new file mode 100644 index 000000000..ecd0db450 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/const10.C @@ -0,0 +1,33 @@ +// PR C++/52369 +// { dg-do compile { target c++11 } } + +class B // { dg-message "implicitly deleted" } + // { dg-error "uninitialized" "" { target c++11 } 4 } +{ + int const v_; // { dg-message "should be initialized" } +}; + +struct D : B {}; // { dg-error "deleted" } + +class A // { dg-message "implicitly deleted" } + // { dg-error "uninitialized" "" { target c++11 } 12 } +{ + int& ref; // { dg-message "should be initialized" } +}; + +struct C : A {}; // { dg-error "deleted" } + +void f() +{ + D d; // { dg-error "use of deleted" } + new D; // { dg-error "use of deleted" } + D(); // { dg-error "use of deleted" } + new D(); // { dg-error "use of deleted" } + + C c; // { dg-error "use of deleted" } + new C; // { dg-error "use of deleted" } + C(); // { dg-error "use of deleted" } + new C(); // { dg-error "use of deleted" } +} + + diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/const11.C b/gcc-4.9/gcc/testsuite/g++.dg/init/const11.C new file mode 100644 index 000000000..08d5185c0 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/const11.C @@ -0,0 +1,29 @@ +// PR C++/52369 +// { dg-do compile { target { ! c++11 } } } + +class B +{ + int const v_; // { dg-message "should be initialized" } +}; + +struct D : B {}; + +class A +{ + int& ref; // { dg-message "should be initialized" } +}; + +struct C : A {}; + +void f() +{ + D d; // { dg-error "uninitialized" } + new D; // { dg-error "uninitialized" } + D(); + new D(); + + C c; // { dg-error "uninitialized" } + new C; // { dg-error "uninitialized" } + C(); // { dg-error "value-initialization" } + new C(); // { dg-error "value-initialization" } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4-1.C b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4-1.C new file mode 100644 index 000000000..1333b35f9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4-1.C @@ -0,0 +1,21 @@ +// { dg-do compile } + +class foo { +public: + foo(); +}; + +class bar: public foo { // { dg-error "uninitialized" } + // { dg-message "implicitly deleted" "" { target c++11 } 8 } +private: + int const a; // { dg-message "should be initialized" } +}; + +foo::foo() { +} + +int main(int argc, char **argv) +{ + bar x; // { dg-error "deleted" "" { target c++11 } } + // { dg-message "synthesized" "" { target { ! c++11 } } 19 } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4.C b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4.C index 1c92bb973..21034b679 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor4.C @@ -6,9 +6,10 @@ public: foo(); }; -class bar: public foo { // { dg-error "reference|bar::bar" } +class bar: public foo { // { dg-error "uninitialized" } + // { dg-message "implicitly deleted" "" { target c++11 } 9 } private: - int &a; + int &a; // { dg-message "should be initialized" } }; foo::foo() { @@ -16,5 +17,6 @@ foo::foo() { int main(int argc, char **argv) { - bar x; // { dg-message "synthesized|deleted" } + bar x; // { dg-error "deleted" "" { target c++11 } } + // { dg-message "synthesized" "" { target { ! c++11 } } 20 } } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/ctor8.C b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor8.C index 7eb72eb83..3c37790c0 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/ctor8.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/ctor8.C @@ -1,6 +1,6 @@ // PR c++/29039 -typedef struct S { // { dg-error "reference" "" { target c++11 } } +typedef struct S { // { dg-error "reference" "" { target c++11 } } int &r; }; // { dg-warning "'typedef' was ignored" } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/pr25811.C b/gcc-4.9/gcc/testsuite/g++.dg/init/pr25811.C index 0a462be54..c29f40607 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/pr25811.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/pr25811.C @@ -1,51 +1,60 @@ // PR c++/25811 // { dg-do compile } -struct A1 // { dg-error "uninitialized" "" { target c++11 } } +struct A1 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 4 } { - int const j; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const j; // { dg-message "should be initialized" } }; -struct A2 // { dg-error "uninitialized" "" { target c++11 } } +struct A2 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 10 } { - int const volatile i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const volatile i; // { dg-message "should be initialized" } }; -struct A3 // { dg-error "uninitialized" "" { target c++11 } } +struct A3 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 16 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; -struct A4 // { dg-error "uninitialized" "" { target c++11 } } +struct A4 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 22 } { - int const& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const& ref; // { dg-message "should be initialized" } }; -struct A5 // { dg-error "uninitialized" "" { target c++11 } } +struct A5 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 28 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } + int const i; // { dg-message "should be initialized" } }; -template <class T> struct S1 // { dg-error "uninitialized" "" { target c++11 } } +template <class T> struct S1 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 35 } { - T const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const i; // { dg-message "should be initialized" } }; -template <class T> struct S2 // { dg-error "uninitialized" "" { target c++11 } } +template <class T> struct S2 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 41 } { - T const volatile i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const volatile i; // { dg-message "should be initialized" } }; -template <class T> struct S3 // { dg-error "uninitialized" "" { target c++11 } } +template <class T> struct S3 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 47 } { - T& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T& ref; // { dg-message "should be initialized" } }; -template <class T> struct S4 // { dg-error "uninitialized" "" { target c++11 } } +template <class T> struct S4 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 53 } { - T const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } - T& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const i; // { dg-message "should be initialized" } + T& ref; // { dg-message "should be initialized" } }; struct X @@ -55,44 +64,50 @@ struct X int const& r; }; -struct Y11 // { dg-error "uninitialized" "" { target c++11 } } +struct Y11 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 67 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; -struct Y1 // { dg-error "deleted" "" { target c++11 } } +struct Y1 // { dg-error "deleted" "" { target c++11 } } { Y11 a[1]; }; -struct Y22 // { dg-error "uninitialized" "" { target c++11 } } +struct Y22 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 78 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; -struct Y2 // { dg-error "deleted" "" { target c++11 } } +struct Y2 // { dg-error "deleted" "" { target c++11 } } { Y22 a[1]; }; -struct Z1 // { dg-error "uninitialized" "" { target c++11 } } +struct Z1 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 89 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; -struct Z2 // { dg-error "uninitialized" "" { target c++11 } } +struct Z2 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 95 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; -struct Z3 // { dg-error "uninitialized" "" { target c++11 } } +struct Z3 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 101 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; -struct Z4 // { dg-error "uninitialized" "" { target c++11 } } +struct Z4 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 107 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; struct Z5 @@ -100,7 +115,7 @@ struct Z5 int i; }; -struct Z // { dg-error "deleted" "" { target c++11 } } +struct Z // { dg-error "deleted" "" { target c++11 } } { Z1 z1; Z2 z2; @@ -109,9 +124,10 @@ struct Z // { dg-error "deleted" "" { target c++11 } } Z5 z5; }; -union U // { dg-error "uninitialized" "" { target c++11 } } +union U // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 127 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; void f1 () diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/pr29043.C b/gcc-4.9/gcc/testsuite/g++.dg/init/pr29043.C index f341f8c8f..c81c39cb0 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/pr29043.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/pr29043.C @@ -1,9 +1,10 @@ // PR c++/29043 // { dg-do compile } -struct S // { dg-error "uninitialized" "" { target c++11 } } +struct S // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 4 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; class C @@ -13,9 +14,10 @@ public: S s; }; -struct S2 // { dg-error "uninitialized" "" { target c++11 } } +struct S2 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 17 } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; class C2 @@ -33,9 +35,10 @@ class C3 }; }; -struct S4 // { dg-error "uninitialized" "" { target c++11 } } +struct S4 // { dg-message "implicitly deleted" "" { target c++11 } } + // { dg-error "uninitialized" "" { target c++11 } 38 } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; struct C4 @@ -46,7 +49,7 @@ struct C4 struct C5 { - C5() {} // { dg-message "uninitialized" } + C5() {} // { dg-error "uninitialized" } int const iit[ 1 ]; }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/pr43719.C b/gcc-4.9/gcc/testsuite/g++.dg/init/pr43719.C index 81930d07d..c8cebc2de 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/pr43719.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/pr43719.C @@ -1,51 +1,51 @@ // PR c++/43719 // { dg-do compile } -struct A1 // { dg-error "uninitialized" "" { target c++11 } } +struct A1 // { dg-error "uninitialized" "" { target c++11 } } { - int const j; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const j; // { dg-message "should be initialized" } }; -struct A2 // { dg-error "uninitialized" "" { target c++11 } } +struct A2 // { dg-error "uninitialized" "" { target c++11 } } { - int const volatile i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const volatile i; // { dg-message "should be initialized" } }; -struct A3 // { dg-error "uninitialized" "" { target c++11 } } +struct A3 // { dg-error "uninitialized" "" { target c++11 } } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; -struct A4 // { dg-error "uninitialized" "" { target c++11 } } +struct A4 // { dg-error "uninitialized" "" { target c++11 } } { - int const& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const& ref; // { dg-message "should be initialized" } }; -struct A5 // { dg-error "uninitialized" "" { target c++11 } } +struct A5 // { dg-error "uninitialized" "" { target c++11 } } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } + int const i; // { dg-message "should be initialized" } }; template <class T> struct S1 // { dg-error "uninitialized" "" { target c++11 } } { - T const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const i; // { dg-message "should be initialized" } }; template <class T> struct S2 // { dg-error "uninitialized" "" { target c++11 } } { - T const volatile i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const volatile i; // { dg-message "should be initialized" } }; template <class T> struct S3 // { dg-error "uninitialized" "" { target c++11 } } { - T& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T& ref; // { dg-message "should be initialized" } }; template <class T> struct S4 // { dg-error "uninitialized" "" { target c++11 } } { - T const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } - T& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + T const i; // { dg-message "should be initialized" } + T& ref; // { dg-message "should be initialized" } }; struct X @@ -55,9 +55,9 @@ struct X int const& r; }; -struct Y11 // { dg-error "uninitialized" "" { target c++11 } } +struct Y11 // { dg-error "uninitialized" "" { target c++11 } } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; struct Y1 // { dg-error "deleted" "" { target c++11 } } @@ -65,9 +65,9 @@ struct Y1 // { dg-error "deleted" "" { target c++11 } } Y11 a[1]; }; -struct Y22 // { dg-error "uninitialized" "" { target c++11 } } +struct Y22 // { dg-error "uninitialized" "" { target c++11 } } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; struct Y2 // { dg-error "deleted" "" { target c++11 } } @@ -75,24 +75,24 @@ struct Y2 // { dg-error "deleted" "" { target c++11 } } Y22 a[1]; }; -struct Z1 // { dg-error "uninitialized" "" { target c++11 } } +struct Z1 // { dg-error "uninitialized" "" { target c++11 } } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; -struct Z2 // { dg-error "uninitialized" "" { target c++11 } } +struct Z2 // { dg-error "uninitialized" "" { target c++11 } } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; -struct Z3 // { dg-error "uninitialized" "" { target c++11 } } +struct Z3 // { dg-error "uninitialized" "" { target c++11 } } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; -struct Z4 // { dg-error "uninitialized" "" { target c++11 } } +struct Z4 // { dg-error "uninitialized" "" { target c++11 } } { - int& ref; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int& ref; // { dg-message "should be initialized" } }; struct Z5 @@ -109,9 +109,9 @@ struct Z // { dg-error "deleted" "" { target c++11 } } Z5 z5; }; -union U // { dg-error "uninitialized" "" { target c++11 } } +union U // { dg-error "uninitialized" "" { target c++11 } } { - int const i; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i; // { dg-message "should be initialized" } }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C b/gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C index 96b5bef1c..c3e9d4e56 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C @@ -1,9 +1,9 @@ // PR c++/44086 // { dg-do compile } -struct A // { dg-error "uninitialized" "" { target c++11 } } +struct A // { dg-error "uninitialized" "" { target c++11 } } { - int const i : 2; // { dg-message "should be initialized" "" { target { ! c++11 } } } + int const i : 2; // { dg-message "should be initialized" } }; void f() diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C b/gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C index 1e4f7ae84..e8509ff4b 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C @@ -1,8 +1,8 @@ // PR c++/58126 -struct A { // { dg-error "uninitialized" "" { target c++11 } } - const int value1; - int& value2; +struct A { // { dg-error "uninitialized" "" { target c++11 } } + const int value1; // { dg-message "should be initialized" } + int& value2; // { dg-message "should be initialized" } }; struct B : A { }; // { dg-error "deleted" "" { target c++11 } } |