Issue 149960
Summary [clang-format] unwanted space added between an identifier named 'import' and a open angle bracket
Labels clang-format
Assignees
Reporter RoyAwesome
    Using clang-format version 20.1.8

I have a template function named `import` and clang-format keeps inserting an unwanted space between the identifier and the template params.  

```cpp
 _world->component<engine_info_t>(); // normal template params are formatted correctly 
_world->import <engine_module>(); // Unwanted space after import but before <
```

I haven't found any other case where this extra space is inserted.  I suspect it's because `import` is a contextual keyword related to cpp20 modules and clang-format is not understanding this isn't a module import.


I can't attach my .clang-format so here it is:

```
Language: Cpp
BasedOnStyle: Microsoft
DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Left
IndentWidth: 4
BreakTemplateDeclarations: Yes
BreakBeforeConceptDeclarations: Always
SpaceAfterTemplateKeyword: false
RequiresExpressionIndentation: OuterScope
IndentRequiresClause: true
NamespaceIndentation: All
FixNamespaceComments: false
SpaceBeforeParens: Never
SpacesInAngles: Never
AllowShortFunctionsOnASingleLine: Inline
PackConstructorInitializers: Never
BreakConstructorInitializers: BeforeComma
AllowShortCaseLabelsOnASingleLine: true
IndentCaseLabels: true
InsertBraces: true
IndentAccessModifiers: false
SpaceBeforeCpp11BracedList: true
AlignArrayOfStructures: Left
AllowShortLambdasOnASingleLine: All
BreakBeforeBraces: Custom
BraceWrapping:
  BeforeLambdaBody: false
  AfterFunction: true
SortIncludes: CaseInsensitive
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to