Skip to content

clang incorrectly expands trigraphs when pasting tokens #158360

@DutChen18

Description

@DutChen18

This program prints |, but it should print ??!.

#include <stdio.h>

#define PASTE(X, Y) X ## Y

int main(void) {
	printf("%ls\n", PASTE(L, "??\
!"));
}

After pasting the tokens L and "??!", clang incorrectly expands the trigraph inside of the second token.

https://godbolt.org/z/s7esnTdjz

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions