-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Alias template produces seemingly bogus "template template argument has different template parameters" error #36505
Comments
Looks like -frelaxed-template-template-args enables the fix for this (off by default). See the commit message for r290792 for more info. If we're going to keep this off by default, it would be nice to have better diagnostics for cases like this. |
@llvm/issue-subscribers-clang-frontend Author: Arthur O'Dwyer (Quuxplusone)
| | |
| --- | --- |
| Bugzilla Link | [37157](https://llvm.org/bz37157) |
| Version | trunk |
| OS | All |
| CC | @DougGregor |
Extended DescriptionI (and also GCC 7.0-and-later) claim that this program is legal C++.
Clang, on the other hand, bails out at line 2: prog.cc:2:50: error: template template argument has different template parameters than its corresponding template template parameter Clang becomes happy if I change it from 'using B = A<Y>' to 'struct B {}', and then sad again if I change it to 'struct B : A<Y> {}'. |
…efault In order to implement this as a DR and avoid breaking reasonable code that worked before P0522, this patch implements a provisional resolution for CWG2398: When deducing template template parameters against each other, and the argument side names a template specialization, instead of just deducing A, we instead deduce a synthesized template template parameter based on A, but with it's parameters using the template specialization's arguments as defaults. The driver flag is deprecated with a warning. With this patch, we finally mark C++17 support in clang as complete. Fixes llvm#36505
…efault In order to implement this as a DR and avoid breaking reasonable code that worked before P0522, this patch implements a provisional resolution for CWG2398: When deducing template template parameters against each other, and the argument side names a template specialization, instead of just deducing A, we instead deduce a synthesized template template parameter based on A, but with it's parameters using the template specialization's arguments as defaults. The driver flag is deprecated with a warning. With this patch, we finally mark C++17 support in clang as complete. Fixes llvm#36505
…efault (#89807) This patch will finally allow us to mark C++17 support in clang as complete. In order to implement this as a DR and avoid breaking reasonable code that worked before P0522, this patch implements a provisional resolution for CWG2398: When deducing template template parameters against each other, and the argument side names a template specialization, instead of just deducing A, we deduce a synthesized template template parameter based on A, but with it's parameters using the template specialization's arguments as defaults. The driver flag is deprecated with a warning. Fixes #36505
Extended Description
I (and also GCC 7.0-and-later) claim that this program is legal C++.
Clang, on the other hand, bails out at line 2:
prog.cc:2:50: error: template template argument has different template parameters than its corresponding template template parameter
template<template<class...> class Y> using B = A;
^
prog.cc:2:19: note: template type parameter pack does not match template type parameter in template argument
template<template<class...> class Y> using B = A;
^
prog.cc:1:19: note: previous template type parameter declared here
template<template class X> struct A {};
^
Clang becomes happy if I change it from 'using B = A' to 'struct B {}', and then sad again if I change it to 'struct B : A {}'.
The text was updated successfully, but these errors were encountered: