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

Reference declarator in for-range-declaration of 'for...' loop causes crash #24

Open
Jenny-fa opened this issue May 5, 2017 · 0 comments
Labels

Comments

@Jenny-fa
Copy link
Contributor

Jenny-fa commented May 5, 2017

In the following C++ source code, when the loop variable i is either an lvalue or rvalue reference, Clang will crash due to a failed assertion in VarDecl::checkInitIsICE().

// tuple-for.cpp

#include <iostream>
#include <tuple>

int main() {
  auto t = std::make_tuple(0, 0.1, "meep");

  for... (auto i : t) // This is fine.
    std::cout << i << '\n';

  for... (auto &i : t) // Crash!
    std::cout << i << '\n';

  for... (auto &&i : t) // Crash!
    std::cout << i << '\n';

  return 0;
}
@Jenny-fa Jenny-fa added the bug label May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant