[Bug c++/81202] Concept parsing error for default template arguments

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 3 13:51:00 GMT 2019


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-12-03
             Blocks|                            |67491
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Your spacebar seems to be broken, and your testcase is incomplete ("tple"?!)

Fixed:

template<class T, class AT = void>
  constexpr bool IsPtrC = true;

template<class T, class AT = void> concept bool IsPtrC2 = IsPtrC<T, AT>;

template<bool B> using TEST = int;

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

This is still rejected by current versions of GCC with -std=gnu++17 -fconcepts.

With GCC 8 and 9:

81202.cc:9:1: error: parse error in template argument list
    9 | TEST<IsPtrC2<int>> j;       // error: parse error in template argument
list
      | ^~~~~~~~~~~~~~~~~~~~
81202.cc:9:1: error: declaration does not declare anything [-fpermissive]


And with trunk:

81202.cc:9:17: error: type/value mismatch at argument 1 in template parameter
list for 'template<bool B> using TEST = int'
    9 | TEST<IsPtrC2<int>> j;       // error: parse error in template argument
list
      |                 ^~
81202.cc:9:17: note:   expected a constant of type 'bool', got 'auto [requires
IsPtrC2<<placeholder>, int>]'


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues


More information about the Gcc-bugs mailing list