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

[fuzz] Assertion `Field->getInClassInitializer() && "initializer hasn't been parsed"' failed. #22229

Closed
llvmbot opened this issue Dec 10, 2014 · 4 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 10, 2014

Bugzilla Link 21855
Resolution FIXED
Resolved on Feb 21, 2019 14:19
Version trunk
OS Linux
Blocks #23431
Attachments test case
Reporter LLVM Bugzilla Contributor
CC @erichkeane,@rnk

Extended Description

Fuzzing discovered that the attached test case, when given as input to

clang -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm

causes this assertion failure:

clang-3.6: tools/clang/include/clang/AST/ExprCXX.h:975: clang::Expr *clang::CXXDefaultInitExpr::getExpr(): Assertion `Field->getInClassInitializer() && "initializer hasn't been parsed"' failed.

@rnk
Copy link
Collaborator

rnk commented Oct 22, 2016

Still repros

@erichkeane
Copy link
Collaborator

I discovered this with one of our internal tests. Our reduced test case is similar and has the same issues:

template < class > struct A
{
int N = sizeof (A < wchar_t >) /;
void F()
{
A < wchar_t > a;
}
};

clang -std=c++11

@rnk
Copy link
Collaborator

rnk commented Feb 21, 2019

Looks like this was fixed. Erich's example gives a proper error like so:

template struct A {
int N = sizeof(A<wchar_t>) / ;
void F() { A<wchar_t> a; }
};

$ clang -cc1 -std=c++11 t.cpp -emit-llvm
t.cpp:3:37: error: expected expression
int N = sizeof (A < wchar_t >) /;
^
1 error generated.

And the original attached test case doesn't crash.

@kcc
Copy link
Contributor

kcc commented Nov 26, 2021

mentioned in issue #23431

@kcc kcc mentioned this issue Mar 28, 2015
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 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 clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

4 participants