Skip to content

Error occurred in default value that with << in constructor #223

@XadillaX

Description

@XadillaX

The code below will occur an error:

class A {
  A(int b, int c, int a = 1 << 1) {}
};

The information is:

Traceback (most recent call last):
  File "cpplint.py", line 6923, in <module>
    main()
  File "cpplint.py", line 6908, in main
    ProcessFile(filename, _cpplint_state.verbose_level)
  File "cpplint.py", line 6678, in ProcessFile
    ProcessFileData(filename, file_extension, lines, Error,
  File "cpplint.py", line 6506, in ProcessFileData
    ProcessLine(filename, file_extension, clean_lines, line,
  File "cpplint.py", line 6390, in ProcessLine
    CheckForNonStandardConstructs(filename, clean_lines, line,
  File "cpplint.py", line 3408, in CheckForNonStandardConstructs
    constructor_arg += ',' + constructor_args[i + 1]
IndexError: list index out of range

And the code without << will be ok:

class A {
  A(int b, int c, int a = 1) {}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions