aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-10-29 08:35:49 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-10-29 08:35:49 +0000
commitec7e5618bc8b9d720803a3857eb787983b089318 (patch)
tree03090592208f20c04fbd230a804f71a68e60a03b /gcc/testsuite
parent1dc82a999cf05e3138d83ea248106c9ec9d7d082 (diff)
downloadgcc-ec7e5618bc8b9d720803a3857eb787983b089318.zip
gcc-ec7e5618bc8b9d720803a3857eb787983b089318.tar.gz
gcc-ec7e5618bc8b9d720803a3857eb787983b089318.tar.bz2
typeck.c (composite_pointer_type): Remove comment about DR 195.
cp: * typeck.c (composite_pointer_type): Remove comment about DR 195. (build_reinterpret_cast_1): Revert DR195 patch. Only emit a warning when being pedantic. (build_reinterpet_cast, build_c_cast): Adjust. testsuite: * g++.dg/conversion/dr195.C: Adjust expected errors for DR195 not being implemented. * g++.dg/conversion/dr195-1.C: New. * g++.old-deja/g++.brendan/operators4.C: Don't be pedantic. * g++.old-deja/g++.mike/p10148.C: Likewise. From-SVN: r89826
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/conversion/dr195-1.C34
-rw-r--r--gcc/testsuite/g++.dg/conversion/dr195.C16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/operators4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p10148.C1
5 files changed, 56 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 089fc64..f6f3bde 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/conversion/dr195.C: Adjust expected errors for DR195 not
+ being implemented.
+ * g++.dg/conversion/dr195-1.C: New.
+ * g++.old-deja/g++.brendan/operators4.C: Don't be pedantic.
+ * g++.old-deja/g++.mike/p10148.C: Likewise.
+
2004-10-29 Mark Mitchell <mark@codesourcery.com>
PR c++/17695
diff --git a/gcc/testsuite/g++.dg/conversion/dr195-1.C b/gcc/testsuite/g++.dg/conversion/dr195-1.C
new file mode 100644
index 0000000..ca38580
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/dr195-1.C
@@ -0,0 +1,34 @@
+// { dg-options "" }
+
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 20 Oct 2004 <nathan@codesourcery.com>
+
+// DR 195 will allow conversions between function and object pointers
+// under some circumstances. It is in drafting, so we don't implement
+// it (yet).
+
+// this checks we are silent when not being pedantic.
+
+typedef void (*PF)(void);
+typedef void *PV;
+typedef int *PO;
+
+
+void foo ()
+{
+ PF pf;
+ PV pv;
+ PO po;
+
+ /* the following two will almost definitly be ok with 195. */
+ pf = reinterpret_cast <PF>(pv);
+ pv = reinterpret_cast <PV>(pf);
+
+ /* the following two might or might not be ok with 195. */
+ pf = reinterpret_cast <PF>(po);
+ po = reinterpret_cast <PO>(pf);
+
+ /* These will never be ok, as they are implicit. */
+ pv = pf; // { dg-error "invalid conversion" "" }
+ pf = pv; // { dg-error "invalid conversion" "" }
+}
diff --git a/gcc/testsuite/g++.dg/conversion/dr195.C b/gcc/testsuite/g++.dg/conversion/dr195.C
index e6cf18e..902b871 100644
--- a/gcc/testsuite/g++.dg/conversion/dr195.C
+++ b/gcc/testsuite/g++.dg/conversion/dr195.C
@@ -1,25 +1,31 @@
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 Oct 2004 <nathan@codesourcery.com>
-// DR 195 allows conversions between function and object pointers
-// under some circumstances.
+// DR 195 will allow conversions between function and object pointers
+// under some circumstances. It is in drafting, so we don't implement
+// it (yet).
+
+// This checks we warn when being pedantic.
typedef void (*PF)(void);
typedef void *PV;
typedef int *PO;
-
void foo ()
{
PF pf;
PV pv;
PO po;
- pf = reinterpret_cast <PF>(pv);
- pv = reinterpret_cast <PV>(pf);
+ /* the following two will almost definitly be ok with 195. */
+ pf = reinterpret_cast <PF>(pv); // { dg-warning "casting between" "" }
+ pv = reinterpret_cast <PV>(pf); // { dg-warning "casting between" "" }
+
+ /* the following two might or might not be ok with 195. */
pf = reinterpret_cast <PF>(po); // { dg-error "casting between" "" }
po = reinterpret_cast <PO>(pf); // { dg-error "casting between" "" }
+ /* These will never be ok, as they are implicit. */
pv = pf; // { dg-error "invalid conversion" "" }
pf = pv; // { dg-error "invalid conversion" "" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C b/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C
index 1f033a6..d5613f1 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/operators4.C
@@ -1,4 +1,6 @@
// { dg-do assemble }
+// { dg-options "" }
+
// GROUPS passed operators
// Check that the & operator, when applied to a global function
// or member function returns a proper value as long as the context
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10148.C b/gcc/testsuite/g++.old-deja/g++.mike/p10148.C
index 6661e6b..2cb359c 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p10148.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p10148.C
@@ -1,4 +1,5 @@
// { dg-do run }
+// { dg-options "" }
// prms-id: 10148
int fail = 1;