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 segfaults with complicated constexpr code #12670

Closed
llvmbot opened this issue Mar 18, 2012 · 6 comments
Closed

clang segfaults with complicated constexpr code #12670

llvmbot opened this issue Mar 18, 2012 · 6 comments
Labels
bugzilla Issues migrated from bugzilla c++11

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 18, 2012

Bugzilla Link 12298
Resolution FIXED
Resolved on Sep 06, 2016 16:54
Version trunk
OS MacOS X
Attachments The (meta)program, Log of gdb session with clang Debug+Assert
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

clang r153011 segfaults without assertion when compiling the attached program using libc++ r152981.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Mar 20, 2012

Smaller testcase:

struct S {
template constexpr static T f(T k) { return g(k); }
template constexpr static T g(T k) { return k ? f(k-1) : 0; }
};
constexpr int n = S().f(1);

While instantiating f, we mark g as referenced and try to instantiate it. While instantiating g, we mark f as referenced, don't notice we're already in the middle of instantiating it, and try to instantiate it again. We should accept this code, but should reject similar code where the mutually recursive calls between f and g occur in locations where a constant expression is required.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Mar 21, 2013

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

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Aug 31, 2016

Fixed in r280190.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Nov 26, 2021

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

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 26, 2021

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

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 26, 2021

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

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

No branches or pull requests

1 participant