Jump to page: 1 2
Thread overview
[Issue 23700] compilable/test22842.c:64:24: error: expression in static assertion is not constant
Feb 12, 2023
Iain Buclaw
Feb 12, 2023
Iain Buclaw
Feb 15, 2023
Iain Buclaw
Feb 16, 2023
Iain Buclaw
Feb 20, 2023
Walter Bright
[Issue 23700] ImportC: Missing examples of ImportC leveraging CTFE
Feb 20, 2023
Iain Buclaw
Feb 20, 2023
Iain Buclaw
Feb 21, 2023
Walter Bright
Feb 21, 2023
Walter Bright
Feb 21, 2023
Iain Buclaw
February 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, ImportC
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=23689
         Depends on|                            |23689


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=23689
[Issue 23689] ImportC: C tests in the testsuite are not valid C
--
February 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Another failing test:

compilable/test23031.c:9:25: error: expression in static assertion is not
constant
    9 | _Static_assert("\x1"[0] == 1, "5");
      |                ~~~~~~~~~^~~~
compilable/test23031.c:10:26: error: expression in static assertion is not
constant
   10 | _Static_assert("\x20"[0] == 0x20, "6");
      |                ~~~~~~~~~~^~~~~~~
compilable/test23031.c:11:27: error: expression in static assertion is not
constant
   11 | _Static_assert("\x020"[0] == 0x20, "7");
      |                ~~~~~~~~~~~^~~~~~~
compilable/test23031.c:12:28: error: expression in static assertion is not
constant
   12 | _Static_assert("\x0020"[0] == 0x20, "8");
      |                ~~~~~~~~~~~~^~~~~~~
compilable/test23054.c:23:25: error: expression in static assertion is not
constant
   23 | _Static_assert(test1(1) == 2, "1");
      |                ~~~~~~~~~^~~~
compilable/test23054.c:24:25: error: expression in static assertion is not
constant
   24 | _Static_assert(test2(1) == 0, "2");
      |                ~~~~~~~~~^~~~


```
/* https://issues.dlang.org/show_bug.cgi?id=23031
 */

_Static_assert(sizeof("\x1") == 2, "1");
_Static_assert(sizeof("\x20") == 2, "2");
_Static_assert(sizeof("\x020") == 2, "3");
_Static_assert(sizeof("\x0020") == 2, "4");

_Static_assert("\x1"[0] == 1, "5");
_Static_assert("\x20"[0] == 0x20, "6");
_Static_assert("\x020"[0] == 0x20, "7");
_Static_assert("\x0020"[0] == 0x20, "8");
```

--
February 15, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Many more _Static_assert tests that fail with gcc, but pass with dmd.

compilable/testcstuff1.c:113:25: error: expression in static assertion is not
constant
  113 | _Static_assert(f1(4, 2) == 7, "ok");
      |                ~~~~~~~~~^~~~
compilable/testcstuff1.c:131:22: error: expression in static assertion is not
constant
  131 | _Static_assert(s1(3) == 10, "s1(3) == 10");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:139:22: error: expression in static assertion is not
constant
  139 | _Static_assert(s2(3) == 10, "s2(3) == 10");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:150:22: error: expression in static assertion is not
constant
  150 | _Static_assert(s3(3) == 10, "s3(3) == 10");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:163:22: error: expression in static assertion is not
constant
  163 | _Static_assert(s4(1) ==  1, "s4(1) == 1");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:164:22: error: expression in static assertion is not
constant
  164 | _Static_assert(s4(3) == 10, "s4(3) == 10");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:165:22: error: expression in static assertion is not
constant
  165 | _Static_assert(s4(5) == 11, "s4(5) == 11");
      |                ~~~~~~^~~~~
compilable/testcstuff1.c:175:22: error: expression in static assertion is not
constant
  175 | _Static_assert(s5(3) == 4, "s5(3) == 4");
      |                ~~~~~~^~~~
compilable/testcstuff1.c:176:22: error: expression in static assertion is not
constant
  176 | _Static_assert(s5(4) == 5, "s5(4) == 5");
      |                ~~~~~~^~~~

--
February 16, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This is somewhat documented on https://dlang.org/spec/importc.html#ctfe

Perhaps some examples of what ImportC can do vs. GCC.

--
February 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
Indeed, CTFE is an ImportC extension. It's very useful for writing test cases like these.

--
February 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dmd                         |dlang.org
            Summary|compilable/test22842.c:64:2 |ImportC: Missing examples
                   |4: error: expression in     |of ImportC leveraging CTFE
                   |static assertion is not     |
                   |constant                    |

--
February 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

--- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Walter Bright from comment #4)
> Indeed, CTFE is an ImportC extension. It's very useful for writing test cases like these.
Updated title, the page really should give some quick examples.

--
February 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=23694

--
February 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dlang.org/pull/3535

--
February 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23700

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #7 from Iain Buclaw <ibuclaw@gdcproject.org> ---


*** This issue has been marked as a duplicate of issue 23694 ***

--
« First   ‹ Prev
1 2