Skip to content

Invalid reference to function concept w. trivial origin::Number usage #10

@JLospinoso

Description

@JLospinoso

Hello,

This simple program yields a compiler error:

#include <origin/core/concepts.hpp>

void foo(origin::Number x) { }

int main()
{
  foo(10);
}

The error is the following:

/home/jalospinoso/concepts/main.cpp: In function ‘int main()’:
/home/jalospinoso/concepts/main.cpp:7:9: error: invalid reference to function concept ‘template<class T> concept bool origin::Ordered()’
   foo(10);
         ^
/home/jalospinoso/concepts/main.cpp:7:9: error: cannot call function ‘void foo(auto:1) [with auto:1 = int]’
/home/jalospinoso/concepts/main.cpp:3:6: note:   constraints not satisfied
 void foo(origin::Number x) { }
      ^~~
In file included from /home/jalospinoso/concepts/main.cpp:1:0:
/usr/local/include/origin/core/concepts.hpp:442:10: error: invalid reference to function concept ‘template<class T> concept bool origin::Ordered()’
   return Ordered<T>
          ^~~~~~~~~~
/usr/local/include/origin/core/concepts.hpp:440:14: note: within ‘template<class T> concept bool origin::Number() [with T = int]’
 concept bool Number()
              ^~~~~~
/home/jalospinoso/concepts/main.cpp:7:9: note: ill-formed constraint
   foo(10);
         ^
CMakeFiles/concepts.dir/build.make:62: recipe for target 'CMakeFiles/concepts.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/concepts.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/concepts.dir/all' failed
make[1]: *** [CMakeFiles/concepts.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Is this related to this GCC bug?

Thanks in advance. The concepts TS is very exciting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions