FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[BUG] Concept is generated in type definition section while needed in type declaration section · Issue #1388 · hsutter/cppfront · GitHub

[BUG] Concept is generated in type definition section while needed in type declaration section #1388

Description

Describe the bug
Pretty self-explanatory. Concepts are generated in the type definition section of a generated file (header or source file); but a template class with said concept will be declared in the type declaration section, before the concept is defined, resulting in an error later.

To Reproduce

import <type_traits>;

Foo: @interface type = {}

FooType: <T> concept = std::is_base_of_v<Foo, T>;

Bar: <T: FooType> type = {}

Generated code :

class Foo;

template<FooType T> class Bar; //FooType needed here

import <type_traits>;

class Foo {/* ... */};

template<typename T> concept FooType = std::is_base_of_v<Foo,T>; //FooType only declared here

template<FooType T> class Bar {/* ... */};

Discussion
Since concepts can be used as part of a class declaration, I think they should be placed in the declaration section, even if it's essentially a definition.
That said, I'm not sure it's trivial and I don't know all the implications. I'm not fully familiar with concepts, but it seems to me that you can do quite complex things in concept definitions, perhaps some need more than a simple type declaration to be compiled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL