[Bug c++/88595] New: Template type lacking template-id-expr

nathan at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 25 15:11:00 GMT 2018


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

            Bug ID: 88595
           Summary: Template type lacking template-id-expr
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 45287
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45287&action=edit
testcase

g++ -std=c++17 fails to compile this with:
nathan@morden:80>g++ -std=c++17 b.cc -S -pedantic
b.cc:10:3: error: invalid use of template-name ‘Any’ without an argument list
   Any car; // #1
   ^~~
b.cc: In constructor ‘constexpr Container::Container(int)’:
b.cc:12:44: error: member ‘Container::car’ must be initialized by
mem-initializer in ‘constexpr’ constructor
   constexpr Container (int car) :car(car) {}
                                            ^
b.cc:10:7: note: declared here
   Any car; // #1
       ^~~
rejecting the declaration at #1.  but look at the declaration #2, which uses an
identical name for the type and is accepted.

Using 'Any<>' works in both places.  I'm not sure whether #1 or #2 is correct.


More information about the Gcc-bugs mailing list