Hi,
On 12 Jan 2025, at 12:10, Simon Martin wrote:
> While testing an unrelated C++ patch with "make check-c++-all", I
> noticed that r15-6760-g38a13ea4117b96 added a test case that fails
> with
> -fimplicit-constexpr.
>
> The problem is that this test unconditionally expects an error stating
> that a non-constexpr function is called, but that function is
> auto-magically constexpr'd under -fimplicit-constexpr.
>
> This patch adapts the test to also pass with -fimplicit-constexpr.
>
> Successfully tested on x86_64-apple-darwin19.6.0 with
> make check-c++-all RUNTESTFLAGS="dg.exp=constexpr-asm-5.C"
Ping? This is borderline obvious but since I’ve never played with
inline assembly, I’d appreciate a second pair of eyes.
Thanks, Simon
>
> PR c++/118277
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/cpp1z/constexpr-asm-5.C: Fix with -fimplicit-constexpr.
>
> ---
> gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C
> b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C
> index 1c20b9dfec1..84faacc9b83 100644
> --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C
> +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C
> @@ -107,10 +107,10 @@ foo ()
> // { dg-error "conversion from 'const char\\\*'
> to '\[^']*' in a
> converted constant expression" "" { target *-*-* } .-2 }
> asm ("" : : : (G {})); // { dg-error "constexpr string
> 'data\\\(\\\)' must be implicitly convertible to 'const char\\\*'" }
> // { dg-error "could not convert
> 'G\\\(\\\).G::data\\\(\\\)' from
> 'float' to 'const char\\\*'" "" { target *-*-* } .-1 }
> - asm ("" : "=r" (v1), (H {}) (v2)); // { dg-error "call to
> non-'constexpr' function 'short int H::size\\\(\\\) const'" }
> - // { dg-error "constexpr string 'size\\\(\\\)'
> must be a constant
> expression" "" { target *-*-* } .-1 }
> - asm ((I {})); // { dg-error "call to non-'constexpr'
> function
> 'const char\\\* I::data\\\(\\\) const'" }
> - // { dg-error "constexpr string 'data\\\(\\\)'
> must be a core
> constant expression" "" { target *-*-* } .-1 }
> + asm ("" : "=r" (v1) : (H {}) (v2)); // { dg-error "call to
> non-'constexpr' function 'short int H::size\\\(\\\) const'" "" {
> target { ! implicit_constexpr } } }
> + // { dg-error "constexpr string 'size\\\(\\\)'
> must be a constant
> expression" "" { target { ! implicit_constexpr } } .-1 }
> + asm ((I {})); // { dg-error "call to non-'constexpr'
> function
> 'const char\\\* I::data\\\(\\\) const'" "" { target { !
> implicit_constexpr } } }
> + // { dg-error "constexpr string 'data\\\(\\\)'
> must be a core
> constant expression" "" { target { ! implicit_constexpr } } .-1 }
>
> asm ((J (0)));
> asm ("" :: (J (1)) (1)); // { dg-error "constexpr string
> 'size\\\(\\\)' must be a constant expression" }
> @@ -180,10 +180,10 @@ bar ()
> // { dg-error "conversion from 'const char\\\*'
> to '\[^']*' in a
> converted constant expression" "" { target *-*-* } .-2 }
> asm ("" : : : (G {})); // { dg-error "constexpr string
> 'data\\\(\\\)' must be implicitly convertible to 'const char\\\*'" }
> // { dg-error "could not convert
> 'G\\\(\\\).G::data\\\(\\\)' from
> 'float' to 'const char\\\*'" "" { target *-*-* } .-1 }
> - asm ("" : "=r" (v1), (H {}) (v2)); // { dg-error "call to
> non-'constexpr' function 'short int H::size\\\(\\\) const'" }
> - // { dg-error "constexpr string 'size\\\(\\\)'
> must be a constant
> expression" "" { target *-*-* } .-1 }
> - asm ((I {})); // { dg-error "call to non-'constexpr'
> function
> 'const char\\\* I::data\\\(\\\) const'" }
> - // { dg-error "constexpr string 'data\\\(\\\)'
> must be a core
> constant expression" "" { target *-*-* } .-1 }
> + asm ("" : "=r" (v1) : (H {}) (v2)); // { dg-error "call to
> non-'constexpr' function 'short int H::size\\\(\\\) const'" "" {
> target { ! implicit_constexpr } } }
> + // { dg-error "constexpr string 'size\\\(\\\)'
> must be a constant
> expression" "" { target { ! implicit_constexpr } } .-1 }
> + asm ((I {})); // { dg-error "call to non-'constexpr'
> function
> 'const char\\\* I::data\\\(\\\) const'" "" { target { !
> implicit_constexpr } } }
> + // { dg-error "constexpr string 'data\\\(\\\)'
> must be a core
> constant expression" "" { target { ! implicit_constexpr } } .-1 }
>
> asm ((J (0)));
> asm ("" :: (J (1)) (1)); // { dg-error "constexpr string
> 'size\\\(\\\)' must be a constant expression" }
> --
> 2.44.0