[Issue 24624] New: Struct with both bitfields and a slice or class instance ref doesn't compile.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24624

  Issue ID: 24624
   Summary: Struct with both bitfields and a slice or class
instance ref doesn't compile.
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: jonas.mee...@gmail.com

Compiling the following code with -preview=bitfields:
---
struct S
{   
char[] slice;
bool flag:1;
}
---
Produces: "Error: cannot take address of bit-field `flag`".

After experimenting it seems that:
  - A struct with bitfields cannot contain:
- Slices of any type.
- Class instance references.
- Structs, enums or references to classes containing any of the above.
  - Bitfields in classes or named unions are not affected.
  - When wrapping the bitfields in a named struct, the issue doesn't happen.
  - With -betterC or ldcs --fno-rtti, the issue doesn't happen.
The issue might involve TypeInfo_Struct?

More failing examples:
---
struct S1
{
bool flag:1;
Object o;
}

struct Wrapper2
{
void[] wrapped;
}
struct S2
{
bool flag:1;
Wrapper2 wrapper;
}

struct Wrapper3
{
Object wrapped;
}
struct S3
{
bool flag:1;
Wrapper3 wrapper;
}

enum Wrapper4 : string
{
empty = ""
}
struct S4
{
bool flag:1;
Wrapper4 wrapper;
}
---

--


[Issue 24623] Rename version CppRuntime_Clang/Gcc to CppRuntime_libcxx/libstdcxx.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24623

--- Comment #3 from johanenge...@weka.io ---
libcpp is the GCC C PreProcessing library).

libstdc++v3 refers to itself as (lib)stdcxx in code.
libc++ similarly.

Changed title of bug report: cpp --> cxx

--


[Issue 24623] Rename version CppRuntime_Clang/Gcc to CppRuntime_libcxx/libstdcxx.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24623

johanenge...@weka.io changed:

   What|Removed |Added

Summary|Rename version  |Rename version
   |CppRuntime_Clang/Gcc to |CppRuntime_Clang/Gcc to
   |CppRuntime_libcpp/libstdcpp |CppRuntime_libcxx/libstdcxx
   |.   |.

--


[Issue 24594] ImportC: Packed struct has wrong layout

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24594

Dlang Bot  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Dlang Bot  ---
dlang/dmd pull request #16611 "Fix bugzilla 24594 - ImportC: Packed struct has
wrong layout" was merged into master:

- d02e12b8ddcf66d435265d443af34f8d3f25faaf by Tim Schendekehl:
  Fix bugzilla 24594 - ImportC: Packed struct has wrong layout

  Packed structs were already implemented with the Microsoft syntax
  (e.g. `#pragma pack(push, 1)`), but the GCC syntax was ignored.

https://github.com/dlang/dmd/pull/16611

--


[Issue 24623] Rename version CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24623

Dlang Bot  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Dlang Bot  ---
dlang/dmd pull request #16610 "Rename CppRuntime_Clang/Gcc to
CppRuntime_libcpp/libstdcpp." was merged into master:

- 349b493810d9fe6f1997df93d23194589f170584 by Johan Engelen:
  Fix bugzilla issue 24623: Rename CppRuntime_Clang/Gcc to
CppRuntime_libcpp/libstdcpp. Add libcpp and libstdcpp -target= option
recognition.

https://github.com/dlang/dmd/pull/16610

--


[Issue 24594] ImportC: Packed struct has wrong layout

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24594

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@tim-dlang created dlang/dmd pull request #16611 "Fix bugzilla 24594 - ImportC:
Packed struct has wrong layout" fixing this issue:

- Fix bugzilla 24594 - ImportC: Packed struct has wrong layout

  Packed structs were already implemented with the Microsoft syntax
  (e.g. `#pragma pack(push, 1)`), but the GCC syntax was ignored.

https://github.com/dlang/dmd/pull/16611

--


[Issue 24623] Rename version CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24623

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@JohanEngelen updated dlang/dmd pull request #16610 "Rename
CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp
https://issues.dlang.org/show_bug.cgi?id=24546 ." fixing this issue:

- Rename CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp.
  Add libcpp and libstdcpp -target= option recognition.

  Fix bugzilla 24623 https://issues.dlang.org/show_bug.cgi?id=24623

https://github.com/dlang/dmd/pull/16610

--


[Issue 24623] New: Rename version CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp.

2024-06-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24623

  Issue ID: 24623
   Summary: Rename version CppRuntime_Clang/Gcc to
CppRuntime_libcpp/libstdcpp.
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johanenge...@weka.io

There is unfortunately an error in druntime CppRuntime version naming.

I think this arises from the wrong assumption that libstdc++ is bound to GCC
and libc++ to clang. This is not the case. For those in the know, it is
actually very confusing to read CppRuntime_Clang in the code. "What is that?!"
Clang works with both libstdc++ and libc++ and it very much depends on the
OS/installation/user which library is actually used.

I had to find this bit in d_do_test.d to learn what it stands for:

version (CppRuntime_Gcc)
envData.cxxCompatFlags = " -L-lstdc++ -L--no-demangle";
else version (CppRuntime_Clang)
envData.cxxCompatFlags = " -L-lc++ -L--no-demangle";
Ah, ok, so CppRuntime_Clang stands for libc++.

Please, please rename
CppRuntime_Gcc => CppRuntime_libstdcpp
CppRuntime_Clang => CppRuntime_libcpp

The -target option should be fixed similarly.

--