Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] Overload resolution fails for __declspec(property) access in expression-list of new-placement #65053

Closed
Sirraide opened this issue Aug 29, 2023 · 2 comments · Fixed by #75883
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party

Comments

@Sirraide
Copy link
Contributor

The following code (also on godbolt) using the MS __declspec(property) extension fails to compile due to overload resolution failure

#include <new>

struct S {
   int get_value() { return 42; }
   __declspec(property(get = get_value)) int i;
   void* operator new(std::size_t, int);
};

void foo(int);

int main() {
    S s;
    foo(s.i);    // ok
    new (s.i) S; // error: no matching function for call to 'operator new'
}

with the following error message:

<source>:14:5: error: no matching function for call to 'operator new'
   14 |     new (s.i) S; // error: no matching function for call to 'operator new'
      |     ^   ~~~~~
<source>:6:10: note: candidate function not viable: no known conversion from '<pseudo-object type>' to 'int' for 2nd argument
    6 |    void* operator new(std::size_t, int);
      |          ^     
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Aug 29, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 29, 2023

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented Aug 29, 2023

CC @AaronBallman

@AaronBallman AaronBallman added the confirmed Verified by a second party label Aug 29, 2023
erichkeane added a commit that referenced this issue Jan 17, 2024
…75883)

It seems we were forgetting to call `checkArgsForPlaceholders` on the
placement arguments of new-expressions in Sema. I don't think that was
intended—at least doing so doesn't seem to break anything—so this pr
adds that.

This also fixes #65053

---------

Co-authored-by: Erich Keane <ekeane@nvidia.com>
ampandey-1995 pushed a commit to ampandey-1995/llvm-project that referenced this issue Jan 19, 2024
…lvm#75883)

It seems we were forgetting to call `checkArgsForPlaceholders` on the
placement arguments of new-expressions in Sema. I don't think that was
intended—at least doing so doesn't seem to break anything—so this pr
adds that.

This also fixes llvm#65053

---------

Co-authored-by: Erich Keane <ekeane@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants