Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined reference to inline function in mixin template #17875

Open
dlangBugzillaToGithub opened this issue Aug 10, 2018 · 1 comment
Open
Labels

Comments

@dlangBugzillaToGithub
Copy link

anonymous4 reported this on 2018-08-10T14:06:27Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19154

Description

mixin template test()
{
        pragma(inline, true) // remove this will work
        static int zzz()
        {
                return 0;
        }
        int dummy = zzz();
}

void f()
{
        mixin test!();
}

Trying to link this code gives
error: undefined reference to '_D9onlineapp1fFZ8__mixin13zzzFNbNiZi'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
@dlangBugzillaToGithub
Copy link
Author

dfj1esp02 commented on 2018-08-10T14:12:26Z

The reason is that the function is not inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant