[PATCH] D149276: [Clang] Fix parsing of `(auto(x))`.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 16 04:42:31 PDT 2023


kadircet added a comment.

hi!

this seem to have regressed compilation for some valid C++ code:

  struct Bar {
    const char *name();
  };
  struct Baz {
    static Bar *method();
  };
  struct Foo {
    Foo(const char *);
  };
  
  template <typename T> void bar() { Foo _(T::method()->name()); }
  void foo() { bar<Baz>(); }

compiles fine without this change, starting with this it produces the following error:

  a.cc:11:55: error: expected unqualified-id
  template <typename T> void bar() { Foo _(T::method()->name()); }
                                                        ^
  a.cc:11:40: error: no matching constructor for initialization of 'Foo'
  template <typename T> void bar() { Foo _(T::method()->name()); }
                                         ^
  a.cc:12:14: note: in instantiation of function template specialization 'bar<Baz>' requested here
  void foo() { bar<Baz>(); }
               ^
  a.cc:8:3: note: candidate constructor not viable: requires 1 argument, but 0 were provided
    Foo(const char *);
    ^
  a.cc:7:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
  struct Foo {
         ^
  a.cc:7:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided

https://github.com/llvm/llvm-project/issues/62733 is the bug report that triggered the investigation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149276/new/

https://reviews.llvm.org/D149276



More information about the cfe-commits mailing list