Jump to page: 1 2
Thread overview
[Issue 24022] ImportC: Error: attribute `__anonymous` is used as a type
Jun 28, 2023
Dmytro Katyukha
Jun 28, 2023
Dmytro Katyukha
Jun 28, 2023
Dlang Bot
Jun 30, 2023
Carsten Schlote
Jun 30, 2023
Dmytro Katyukha
Jun 30, 2023
Dmytro Katyukha
Jul 03, 2023
Carsten Schlote
Jul 05, 2023
Dlang Bot
Jul 12, 2023
Dlang Bot
Jul 15, 2023
Dlang Bot
Jul 15, 2023
Dlang Bot
Aug 14, 2023
Dmytro Katyukha
June 28, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha <firemage.dima@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC
                 CC|                            |firemage.dima@gmail.com

--
June 28, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha <firemage.dima@gmail.com> changed:

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

--
June 28, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

--- Comment #1 from Dlang Bot <dlang-bot@dlang.rocks> ---
@katyukha created dlang/dmd pull request #15365 "Implement test case for Issue 24022" mentioning this issue:

- Implement test case for Issue 24022

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

--
June 30, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Carsten Schlote <carsten.schlote@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carsten.schlote@gmx.net

--- Comment #2 from Carsten Schlote <carsten.schlote@gmx.net> ---
Hi,
i stumbled over this regession bug, too. Simplyfied example to reproduce:

enum_decl.c:
---------------
/// @brief Type ID for signature block
typedef enum FWSIG_TYPE {
    E_FWSIG_TYPE_RSA2048 = 0,
    E_FWSIG_TYPE_RSA3072,
    E_FWSIG_TYPE_RSA4096,
    E_FWSIG_TYPE_EC256 = 16,
    E_FWSIG_TYPE_ECP384,
    E_FWSIG_TYPE_ECP521,
    E_FWSIG_TYPE_ED25519 = 32,
    E_FWSIG_TYPE_UNKNOWN = -1
}
E_FWSIG_TYPE;
---------------
use_enum_decl.d:
---------------
import enum_decl;

E_FWSIG_TYPE getEnumType(string blah)
{
    E_FWSIG_TYPE type = E_FWSIG_TYPE_UNKNOWN;
    return type;
}
---------------
$ dmd --version
DMD64 D Compiler v2.103.1
$ dmd -c use_enum_decl.d
use_enum_decl.d(3): Error: attribute `__anonymous` is used as a type

$ dmd-beta --version
DMD64 D Compiler v2.104.1-beta.1-163-gb549aba8d6
$ dmd-beta -c use_enum_decl.d
use_enum_decl.d(3): Error: attribute `__anonymous` is used as a type

$ ldc2 --version
LDC - the LLVM D compiler (1.32.1):
  based on DMD v2.102.2 and LLVM 15.0.7
$ ldc2 -c use_enum_decl.d
# Compiles fine as previous versions of DMD did.

--
June 30, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha <firemage.dima@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #3 from Dmytro Katyukha <firemage.dima@gmail.com> ---
The fix seems to be ready: https://github.com/dlang/dmd/pull/15365

Waiting for review.

@Carsten Schlote, Please, test the fix on your example (if you have time).

--
June 30, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha <firemage.dima@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody@puremagic.com        |firemage.dima@gmail.com

--
July 03, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

Carsten Schlote <schlote@vahanus.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schlote@vahanus.net

--- Comment #4 from Carsten Schlote <schlote@vahanus.net> ---
I rebased the MR to stable (v2.104.1-2-g5693cbcdd0), compiled it and tested it against my example. Compiles now without error and produces senseful code.

--
July 05, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15365 "ImportC: Issue 24022 - Error: attribute `__anonymous` is used as a type" was merged into stable:

- 0c004d2fb731b063cfb2523d67f5d107987915a5 by Dmytro Katyukha:
  Implement test case for Issue 24022

- 32744ee558c39930c30bd88a2bff725e72761a78 by Dmytro Katyukha:
  [FIX] Issue 24022

  Bug investigation info
  ======================

  Currently (before this fix) on attempt to use `enum`
  declared as `typedef enum {A=1} E;` as type of argument in D function,
  it (`enum`) will be resolved as `kind=attribute` on during semantic
  analysis for D

([typesem.d](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/typesem.d#L1504)),
  but it have to be resolved as type.

  The `enum` declared this way is handled by this

[code](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1907),
  and `declareTag` returns the attribute instead of type, but
  later, there is [code that create alias for
attribute](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1918C29-L1918C79),
  though, it seems, that alias have to be created to type, instead of
attribute.

  Investigating

[declareTag](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1715)
  function shows that the returned value changed by call to
[applySpecifier](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L5234),
  that applies `AlignDeclaration` when `if
  (!specifier.packalign.isDefault())`.

  Fix info
  ========

  With this commit the alias will be created to TypeTag, instead of
  attribute produced by declared tag.

  Also, the code simplified, because there is no more need for special
  handling of enums in modified piece of code.

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

--
July 12, 2023
https://issues.dlang.org/show_bug.cgi?id=24022

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 updated dlang/dmd pull request #15406 "Fix Issue 23951 - traits(getMember) does not follow alias this" mentioning this issue:

- ImportC: Issue 24022 - Error: attribute `__anonymous` is used as a type
(#15365)

  * Implement test case for Issue 24022

  * [FIX] Issue 24022

  Bug investigation info
  ======================

  Currently (before this fix) on attempt to use `enum`
  declared as `typedef enum {A=1} E;` as type of argument in D function,
  it (`enum`) will be resolved as `kind=attribute` on during semantic
  analysis for D

([typesem.d](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/typesem.d#L1504)),
  but it have to be resolved as type.

  The `enum` declared this way is handled by this

[code](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1907),
  and `declareTag` returns the attribute instead of type, but
  later, there is [code that create alias for
attribute](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1918C29-L1918C79),
  though, it seems, that alias have to be created to type, instead of
attribute.

  Investigating

[declareTag](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1715)
  function shows that the returned value changed by call to
[applySpecifier](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L5234),
  that applies `AlignDeclaration` when `if
  (!specifier.packalign.isDefault())`.

  Fix info
  ========

  With this commit the alias will be created to TypeTag, instead of
  attribute produced by declared tag.

  Also, the code simplified, because there is no more need for special
  handling of enums in modified piece of code.

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

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

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ibuclaw created dlang/dmd pull request #15417 "merge stable" mentioning this issue:

- ImportC: Issue 24022 - Error: attribute `__anonymous` is used as a type
(#15365)

  * Implement test case for Issue 24022

  * [FIX] Issue 24022

  Bug investigation info
  ======================

  Currently (before this fix) on attempt to use `enum`
  declared as `typedef enum {A=1} E;` as type of argument in D function,
  it (`enum`) will be resolved as `kind=attribute` on during semantic
  analysis for D

([typesem.d](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/typesem.d#L1504)),
  but it have to be resolved as type.

  The `enum` declared this way is handled by this

[code](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1907),
  and `declareTag` returns the attribute instead of type, but
  later, there is [code that create alias for
attribute](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1918C29-L1918C79),
  though, it seems, that alias have to be created to type, instead of
attribute.

  Investigating

[declareTag](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L1715)
  function shows that the returned value changed by call to
[applySpecifier](https://github.com/dlang/dmd/blob/5e1e97078faff33afbb999bc986ead7bdb0b2653/compiler/src/dmd/cparse.d#L5234),
  that applies `AlignDeclaration` when `if
  (!specifier.packalign.isDefault())`.

  Fix info
  ========

  With this commit the alias will be created to TypeTag, instead of
  attribute produced by declared tag.

  Also, the code simplified, because there is no more need for special
  handling of enums in modified piece of code.

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

--
« First   ‹ Prev
1 2