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

            Bug ID: 88754
           Summary: Constructor call wrongly rejected
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet is wrongly rejected
(since at least GCC 4.1, probably even before):

=============================================
struct A
{
  A(int);
  void foo();
};

template<int N> int value() { return N; }

void bar()
{
  A(value<0>()).foo();    // fails
  (A(value<0>())).foo();  // OK
}
=============================================

bug.cc: In function 'void bar()':
bug.cc:11:4: error: invalid declaration of '::value<0>'
   11 |   A(value<0>()).foo();
      |    ^


The code is compiled by clang and MSVC.

Reply via email to