-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
In situations where the same function is referenced in multiple files, ferret code generation can result in the function definitions being included multiple times. In the following example the bar function is called directly in main, and also indirectly via the foo function:
main.clj:
(require 'foo)
(require 'bar)
(foo/foo)
(bar/bar 0)
foo.clj:
(require 'bar)
(defn foo []
(bar/bar 1))
bar.clj
(defn bar [x]
x)
If you compile main.clj with ferret, it will emit a .cpp file with multiple definitions of the bar function. Trying to compile that .cpp file will result in these errors:
src/main.cpp:2537:7: error: redefinition of 'class main::bar_bar'
class bar_bar {
^~~~~~~
src/main.cpp:2527:7: note: previous definition of 'class main::bar_bar'
class bar_bar {
^~~~~~~
src/main.cpp:2564:12: error: redefinition of 'ferret::var main::bar_bar::invoke(ferret::ref) const'
inline var bar_bar::invoke(ref _args_) const {
^~~~~~~
src/main.cpp:2551:12: note: 'ferret::var main::bar_bar::invoke(ferret::ref) const' previously defined here
inline var bar_bar::invoke(ref _args_) const {
^~~~~~~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels