mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 20:20:29 +00:00
Fix infinite recursion in PrintList. (#642)
Also make `Stack`'s single-argument constructor explicit, which would have helped catch this at compile time.
This commit is contained in:
1 parent
6fa42a7f3c
commit
69b4b0086f
2 files changed
+2
-2
No files matched your search
@@ -57,7 +57,7 @@ struct Stack {
|
||||
Stack() { head = nullptr; }
|
||||
|
||||
// Creates an instance containing just `x`.
|
||||
Stack(T x) : Stack() { Push(x); }
|
||||
explicit Stack(T x) : Stack() { Push(x); }
|
||||
|
||||
// Pushes `x` onto the top of the stack.
|
||||
void Push(T x) { head = new ListNode<T>(x, head); }
|
||||
|
||||
Reference in new issue
Block a user