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

Example from cppreference compiles on godbolt, doesn't compile in insights #333

Closed
NooneAtAll opened this issue Jul 26, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@NooneAtAll
Copy link

Example from https://en.cppreference.com/w/cpp/memory/new/operator_delete
On godbolt: https://godbolt.org/z/cn1K68
On cppinsights: https://cppinsights.io/s/d7c759a7

#include <cstdio>
#include <cstdlib>
// replacement of a minimal set of functions:
void* operator new(std::size_t sz) {
    std::printf("global op new called, size = %zu\n",sz);
    return std::malloc(sz);
}
void operator delete(void* ptr) noexcept
{
    std::puts("global op delete called");
    std::free(ptr);
}
int main() {
     int* p1 = new int;
     delete p1;
 
     int* p2 = new int[10]; // guaranteed to call the replacement in C++11
     delete[] p2;
}
@andreasfertig
Copy link
Owner

Hello @NooneAtAll,

thanks for reporting this! Looks like you found a special case for attributes which leads to that crash. A fix is on its way.

Andreas

@andreasfertig andreasfertig added the bug Something isn't working label Jul 26, 2020
andreasfertig added a commit that referenced this issue Jul 26, 2020
Fixed #333: Check for valid `SourceLocation` of attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants