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 `hasInClassInitializer() && InitStorage.getPointer() == nullptr && "bit width, initializer or captured type already set"' failed. #22234

Closed
llvmbot opened this issue Dec 11, 2014 · 4 comments
Labels
bugzilla Issues migrated from bugzilla c++11

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 11, 2014

Bugzilla Link 21860
Resolution FIXED
Resolved on Oct 21, 2016 18:30
Version trunk
OS Linux
Blocks #23431
Attachments test case
Reporter LLVM Bugzilla Contributor
CC @majnemer,@DougGregor,@zygoloid,@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/Decl.h:2299: void clang::FieldDecl::setInClassInitializer(clang::Expr *): Assertion `hasInClassInitializer() && InitStorage.getPointer() == nullptr && "bit width, initializer or captured type already set"' failed.

@majnemer
Copy link
Mannequin

majnemer mannequin commented Dec 13, 2014

cleaned up a bit:
template struct e {
operator int();
int np1 = e();
};
e a = e();

GCC and MSVC both accept (but generate code that may infinitely recurse).

@majnemer
Copy link
Mannequin

majnemer mannequin commented Dec 13, 2014

Richard, it looks like we keep instantiating the same template over and over again. Any ideas?

@rnk
Copy link
Collaborator

rnk commented Oct 22, 2016

We now reject:

C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: error: default member initializer for 'np1' uses itself
template struct e {
^
C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: note: in instantiation of default member initializer 'e::np1' requested here
C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: note: in instantiation of default member initializer 'e::np1' requested here
C:/Users/rnk/Downloads/funs-without-prototype.cpp:3:13: note: implicit default constructor for 'e' first required here
int np1 = e();
^
C:/Users/rnk/Downloads/funs-without-prototype.cpp:5:12: note: implicit default constructor for 'e' first required here
e a = e();
^

@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 c++11
Projects
None yet
Development

No branches or pull requests

3 participants