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

Assertion failed: ((!Initializer || isa<ImplicitValueInitExpr>(Initializer) || isa<CXXConstructExpr>(Initializer)) && "Initializer expression that cannot have been implicitly created.") #12433

Closed
tkremenek opened this issue Feb 21, 2012 · 7 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@tkremenek
Copy link
Contributor

Bugzilla Link 12061
Resolution FIXED
Resolved on Feb 23, 2012 09:01
Version trunk
OS All
Attachments delta-reduced example
CC @DougGregor,@tkremenek,@nico

Extended Description

Attached is a delta-reduced example that crashes clang with an assertion failure:

Assertion failed: ((!Initializer || isa(Initializer) || isa(Initializer)) && "Initializer expression that cannot have been implicitly created."), function BuildCXXNew, file /Users/kremenek/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp, line 1023.

While this is invalid code, this assertion failure occurred on the original example which was well-formed.

I believe this is a potential regression related to the generalized initializers work.

To reproduce:

% clang -fsyntax-only reduced.ii

@tkremenek
Copy link
Contributor Author

Related: rdar://problem/10832617

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 21, 2012

Here's a smaller test case, also reduced from well-formed code:

template struct scoped_array {
scoped_array(C* p = null);
};
template struct Foo {
Foo() : a
(new scoped_array[5]) { }
scoped_array< scoped_array > a
;
};
class Bar {};
Foo x;

@nico
Copy link
Contributor

nico commented Feb 22, 2012

This breaks chrome too. Here's the reduced test case for that:

class MessageLoop {
public:
explicit MessageLoop(int type = 0);
};

template
class CookieStoreTest {
protected:
CookieStoreTest() {
new MessageLoop;
}
};

struct CookieMonsterTestTraits {
};

class DeferredCookieTaskTest : public CookieStoreTest {
DeferredCookieTaskTest() {}
};

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2012

Fixed in r151146. Now compiles Matt's and Nico's test cases cleanly, and doesn't crash on Ted's (there's no way to compile that one cleanly). Also works with a variant of Matt's case with two default arguments.

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2012

*** Bug llvm/llvm-bugzilla-archive#12065 has been marked as a duplicate of this bug. ***

1 similar comment
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 23, 2012

*** Bug llvm/llvm-bugzilla-archive#12065 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#12065

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

3 participants