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

-frelaxed-template-template-args: "error: pack expansion used as argument for non-pack parameter of alias template" with constrained alias template #62529

Closed
ecatmur opened this issue May 3, 2023 · 3 comments · Fixed by #91833
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@ecatmur
Copy link

ecatmur commented May 3, 2023

Motivation:

#include <boost/hana/type.hpp>
template<class> requires(true) using U = int;
auto t = boost::hana::template_<U>(boost::hana::type_c<char>);

Reduced:

template<class> requires(true) using U = int;
template<template<typename ...> class, class> struct S {};
template<class T> S<U, T> f();
auto t = f<int>();

compiled with -frelaxed-template-template-args gives:

<source>:2:31: error: pack expansion used as argument for non-pack parameter of alias template
template<template<typename ...> class, class> struct S {};

(we need -frelaxed-template-template-args for other reasons)
Workaround: use std::enable_if_t to constrain alias template instead.

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels May 3, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented May 3, 2023

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented May 3, 2023

@mizvekov
Copy link
Contributor

I believe clang is correct in rejecting it, per CWG1430, which is still open, but has consensus on rejection.

The bug is not diagnosing it, which is an oversight in the pre-P0522 implementation of template template parameter matching, which is still used as a fast path in the post-P0522 implementation. This fast path is purposefully skipped when the argument template is constrained.

mizvekov added a commit to mizvekov/llvm-project that referenced this issue May 10, 2024
This partially reverts b86e099
Just the default is changed back, on the Driver side.
No Frontend changes.
The positive spelling of the flag is undeprecated.

No documentation changes or changelog entries because we plan to revert
this revert as soon as llvm#62529
is fixed.
cor3ntin pushed a commit that referenced this issue May 10, 2024
)

This partially reverts b86e099.

Just the default is changed back, on the Driver side.
No Frontend changes.
The positive spelling of the flag is undeprecated.

No documentation changes or changelog entries because we plan to revert
this revert as soon as #62529
is fixed.
mizvekov added a commit that referenced this issue May 11, 2024
…template parameters

When partial ordering alias templates against template template parameters,
allow pack expansions when the alias has a fixed-size parameter list.

These expansions were generally disallowed by proposed resolution for CWG1430.

By previously diagnosing these when checking template template parameters, we
would be too strict in trying to prevent any potential invalid use.

This flows against the more general idea that template template parameters are
weakly typed, that we would rather allow an argument that might be possibly
misused, and only diagnose the actual misuses during instantiation.

Since this interaction between P0522R0 and CWG1430 is also a backwards-compat
breaking change, we implement provisional wording to allow these.

Fixes #62529
mizvekov added a commit that referenced this issue May 13, 2024
…template parameters

When partial ordering alias templates against template template parameters,
allow pack expansions when the alias has a fixed-size parameter list.

These expansions were generally disallowed by proposed resolution for CWG1430.

By previously diagnosing these when checking template template parameters, we
would be too strict in trying to prevent any potential invalid use.

This flows against the more general idea that template template parameters are
weakly typed, that we would rather allow an argument that might be possibly
misused, and only diagnose the actual misuses during instantiation.

Since this interaction between P0522R0 and CWG1430 is also a backwards-compat
breaking change, we implement provisional wording to allow these.

Fixes #62529
mizvekov added a commit that referenced this issue May 13, 2024
…template parameters

When partial ordering alias templates against template template parameters,
allow pack expansions when the alias has a fixed-size parameter list.

These expansions were generally disallowed by proposed resolution for CWG1430.

By previously diagnosing these when checking template template parameters, we
would be too strict in trying to prevent any potential invalid use.

This flows against the more general idea that template template parameters are
weakly typed, that we would rather allow an argument that might be possibly
misused, and only diagnose the actual misuses during instantiation.

Since this interaction between P0522R0 and CWG1430 is also a backwards-compat
breaking change, we implement provisional wording to allow these.

Fixes #62529
mizvekov added a commit that referenced this issue May 13, 2024
…template parameters (#91833)

When partial ordering alias templates against template template
parameters, allow pack expansions when the alias has a fixed-size
parameter list.

These expansions were generally disallowed by proposed resolution for
CWG1430.

By previously diagnosing these when checking template template
parameters, we would be too strict in trying to prevent any potential
invalid use.

This flows against the more general idea that template template
parameters are weakly typed, that we would rather allow an argument that
might be possibly misused, and only diagnose the actual misuses during
instantiation.

Since this interaction between P0522R0 and CWG1430 is also a
backwards-compat breaking change, we implement provisional wording to
allow these.

Fixes #62529
nhasabni pushed a commit to nhasabni/llvm-project that referenced this issue May 14, 2024
…m#91811)

This partially reverts b86e099.

Just the default is changed back, on the Driver side.
No Frontend changes.
The positive spelling of the flag is undeprecated.

No documentation changes or changelog entries because we plan to revert
this revert as soon as llvm#62529
is fixed.
nhasabni pushed a commit to nhasabni/llvm-project that referenced this issue May 14, 2024
…template parameters (llvm#91833)

When partial ordering alias templates against template template
parameters, allow pack expansions when the alias has a fixed-size
parameter list.

These expansions were generally disallowed by proposed resolution for
CWG1430.

By previously diagnosing these when checking template template
parameters, we would be too strict in trying to prevent any potential
invalid use.

This flows against the more general idea that template template
parameters are weakly typed, that we would rather allow an argument that
might be possibly misused, and only diagnose the actual misuses during
instantiation.

Since this interaction between P0522R0 and CWG1430 is also a
backwards-compat breaking change, we implement provisional wording to
allow these.

Fixes llvm#62529
mub-at-arm pushed a commit to mub-at-arm/llvm-project that referenced this issue May 16, 2024
…m#91811)

This partially reverts b86e099.

Just the default is changed back, on the Driver side.
No Frontend changes.
The positive spelling of the flag is undeprecated.

No documentation changes or changelog entries because we plan to revert
this revert as soon as llvm#62529
is fixed.
mub-at-arm pushed a commit to mub-at-arm/llvm-project that referenced this issue May 16, 2024
…template parameters (llvm#91833)

When partial ordering alias templates against template template
parameters, allow pack expansions when the alias has a fixed-size
parameter list.

These expansions were generally disallowed by proposed resolution for
CWG1430.

By previously diagnosing these when checking template template
parameters, we would be too strict in trying to prevent any potential
invalid use.

This flows against the more general idea that template template
parameters are weakly typed, that we would rather allow an argument that
might be possibly misused, and only diagnose the actual misuses during
instantiation.

Since this interaction between P0522R0 and CWG1430 is also a
backwards-compat breaking change, we implement provisional wording to
allow these.

Fixes llvm#62529
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
5 participants