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

parse more c++ expression alternatives #296

Merged

Commits on Feb 23, 2023

  1. Test for binary expression with variable template args, bug 497931

    Includes test case from comment 8 of bug 497931 with minor correction
    Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=497931
    i-garrison committed Feb 23, 2023
    Configuration menu
    Copy the full SHA
    3f1ea4b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    80c38d2 View commit details
    Browse the repository at this point in the history
  3. Scan for more template-id alternatives in expression, bug 497931

    If parsing expression part for an alternative terminates with BacktrackException,
    selectFallback() would short-circuit to the longest remaining variant. If that
    happens to successfully complete parsing till the end of expression token
    sequence, all of remaining variants are discarded, including the first found
    alternative which was to parse identifier as template name.
    
    This causes expression() to only consider one branchpoint out of all possible
    variants. Allow it to find more variants by scanning through all branchpoints
    looking for the alternative with leftmost parsed boundary.
    
    This is probably still not ideal but fixes this common std library construct:
    
      template <typename T>
      inline constexpr bool X = true;
      template <typename T>
      inline constexpr bool Y = true;
    
      template<typename T> bool predicate() {
        return X<T> && Y<T>; // CDT finds this one: (X) < (T) > (&&Y<T>)
                             // Fix it to also consider (X<T>) && (Y<T>)
      }
    
    Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=497931
    i-garrison committed Feb 23, 2023
    Configuration menu
    Copy the full SHA
    e076caa View commit details
    Browse the repository at this point in the history