public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lewis Hyatt <lhyatt@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Lewis Hyatt <lhyatt@gmail.com>
Subject: [committed] testsuite: Fix C++ UDL tests failing on 32-bit arch [PR103902]
Date: Wed, 19 Jul 2023 23:22:43 -0400	[thread overview]
Message-ID: <20230720032243.3643540-1-lhyatt@gmail.com> (raw)

These tests need to use "size_t" rather than "unsigned long"
for the user-defined literal function arguments.

gcc/testsuite/ChangeLog:

	PR preprocessor/103902
	* g++.dg/cpp0x/udlit-extended-id-1.C: Change "unsigned long" to
	"size_t" throughout.
	* g++.dg/cpp0x/udlit-extended-id-3.C: Likewise.
---

Notes:
    Hello-
    
    As noted on the PR, these newly added tests fail on 32-bit architectures
    because they said "unsigned long" where they are supposed to say "size_t".
    Committed this fix as obvious.
    
    -Lewis

 gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C | 9 +++++----
 gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-3.C | 6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
index 5ea5ef09db6..c7091e9e8a2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C
@@ -1,6 +1,7 @@
 // { dg-do run { target c++11 } }
 // { dg-additional-options "-Wno-error=normalized" }
 #include <cstring>
+#include <cstddef>
 using namespace std;
 
 constexpr unsigned long long operator "" _π (unsigned long long x)
@@ -21,22 +22,22 @@ char x2[2_Π2];
 static_assert (sizeof x1 == 3, "test1");
 static_assert (sizeof x2 == 8, "test2");
 
-const char * operator "" _1σ (const char *s, unsigned long)
+const char * operator "" _1σ (const char *s, size_t)
 {
   return s + 1;
 }
 
-const char * operator ""_Σ2 (const char *s, unsigned long)
+const char * operator ""_Σ2 (const char *s, size_t)
 {
   return s + 2;
 }
 
-const char * operator "" _\U000000e61 (const char *s, unsigned long)
+const char * operator "" _\U000000e61 (const char *s, size_t)
 {
   return "ae";
 }
 
-const char* operator ""_\u01532 (const char *s, unsigned long)
+const char* operator ""_\u01532 (const char *s, size_t)
 {
   return "oe";
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-3.C b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-3.C
index 11292e476e3..cb8a957947a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-3.C
@@ -1,9 +1,11 @@
 // { dg-do compile { target c++11 } }
+#include <cstddef>
+using namespace std;
 
 // Check that we do not look for poisoned identifier when it is a suffix.
 int _ħ;
 #pragma GCC poison _ħ
-const char * operator ""_ħ (const char *, unsigned long); // { dg-bogus "poisoned" }
+const char * operator ""_ħ (const char *, size_t); // { dg-bogus "poisoned" }
 bool operator ""_ħ (unsigned long long x); // { dg-bogus "poisoned" }
 bool b = 1_ħ; // { dg-bogus "poisoned" }
 const char *x = "hbar"_ħ; // { dg-bogus "poisoned" }
@@ -11,5 +13,5 @@ const char *x = "hbar"_ħ; // { dg-bogus "poisoned" }
 /* Ideally, we should not warn here either, but this is not implemented yet.  This
    syntax has been deprecated for C++23.  */
 #pragma GCC poison _ħ2
-const char * operator "" _ħ2 (const char *, unsigned long); // { dg-bogus "poisoned" "" { xfail *-*-*} }
+const char * operator "" _ħ2 (const char *, size_t); // { dg-bogus "poisoned" "" { xfail *-*-*} }
 const char *x2 = "hbar2"_ħ2; // { dg-bogus "poisoned" }

                 reply	other threads:[~2023-07-20  3:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720032243.3643540-1-lhyatt@gmail.com \
    --to=lhyatt@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).