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

Fix #13326: FP shiftNegative for template argument #7045

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ludviggunne
Copy link
Contributor

Would love to get som feedback on this since it's making quite bold assumptions about expression that depend on template arguments.

lib/checkother.cpp Outdated Show resolved Hide resolved
@chrchr-github
Copy link
Collaborator

Seems like more checks could use the new mechanism, e.g. zerodiv:

template <int b>
int f(int a) {
    if constexpr (b > 0) {
        return a / b;
    } else {
        return a - b;
    }
}

int g() {
    return f<0>(2)
}

@ludviggunne
Copy link
Contributor Author

Seems like more checks could use the new mechanism, e.g. zerodiv:

Do you think that should be baked in to this PR?

@chrchr-github
Copy link
Collaborator

Seems like more checks could use the new mechanism, e.g. zerodiv:

Do you think that should be baked in to this PR?

Not necessarily, more like an idea for future work.

@ludviggunne
Copy link
Contributor Author

Not necessarily, more like an idea for future work.

Ok. I suppose I can create a ticket for the more general case when/if this gets merged.

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

Successfully merging this pull request may close these issues.

2 participants