public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/81202] Concept parsing error for default template arguments
       [not found] <bug-81202-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-11  5:00 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2021-12-11  5:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81202

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Full testcase:
#include <type_traits>
#include <tuple>

template<class T,class AT=void> constexpr bool
IsPtrC=std::is_pointer_v<T>&&(std::is_same_v<AT,void>
||std::is_same_v<AT,std::remove_pointer<T>>);
template<class T,class AT=void> concept  IsPtrC2=IsPtrC<T,AT>;
template<bool B> using TEST=int;
int main(int argc,char*argv[]){
  TEST<IsPtrC<int>> i;//OK
  TEST<IsPtrC2<int>> j;//error: parse error in template argument list
  TEST<IsPtrC2<int,void>> k;//OK
  TEST<(IsPtrC2<int>)> l;//OK
}


With -std=c++20 the above code works (as expected) but with -std=c++17
-fconcepts it fails (with GCC 10+).

I will let a C++ maintainer to decide if it should work with -std=c++17
-fconcepts or not.

The error message is:
<source>: In function 'int main(int, char**)':
<source>:10:19: error: type/value mismatch at argument 1 in template parameter
list for 'template<bool B> using TEST = int'
   10 |   TEST<IsPtrC2<int>> j;//error: parse error in template argument list
      |                   ^~
<source>:10:19: note:   expected a constant of type 'bool', got 'auto [requires
IsPtrC2<<placeholder>, int>]'
Compiler returned: 1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-11  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-81202-4@http.gcc.gnu.org/bugzilla/>
2021-12-11  5:00 ` [Bug c++/81202] Concept parsing error for default template arguments pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).