Skip to content

Parsing error when using template type parameter with assignment#2321

Merged
guwirth merged 1 commit intoSonarOpenCommunity:masterfrom
guwirth:fix-2317
Feb 24, 2022
Merged

Parsing error when using template type parameter with assignment#2321
guwirth merged 1 commit intoSonarOpenCommunity:masterfrom
guwirth:fix-2317

Conversation

@guwirth
Copy link
Copy Markdown
Collaborator

@guwirth guwirth commented Feb 22, 2022

There is a PEG issue with the order of

template-parameter:
   type-parameter
   parameter-declaration

type-parameter type-constraint rule matches in case of non integral data type.

Samples:

template <typename T, size_t s = 15 > void f() {}
template <typename T, size_t s = sizeof(T)*2 > void f() {}
template <typename T, size_t s = 1>2 > void f() {}
template <values v = v::ok> void f() {}
template<class T, T::type n = 0> class X;

This change is Reviewable

@guwirth guwirth added the bug label Feb 22, 2022
@guwirth guwirth added this to the 2.0.7 milestone Feb 22, 2022
@guwirth guwirth self-assigned this Feb 22, 2022
@guwirth guwirth force-pushed the fix-2317 branch 5 times, most recently from e3f3a62 to 2c89ba4 Compare February 23, 2022 17:03
- update to SQ 8.9.7.52159 for testing
- update to Maven 3.8.4
- use curl in AppVeyor
- close SonarOpenCommunity#2317

There is a PEG issue with the order of
```
template-parameter:
   type-parameter
   parameter-declaration
```
`type-parameter type-constraint' rule matches in case of non integral data type.

Samples:
```C++
template <typename T, size_t s = 15 > void f() {}
template <typename T, size_t s = sizeof(T)*2 > void f() {}
template <typename T, size_t s = 1>2 > void f() {}
template <values v = v::ok> void f() {}
template<class T, T::type n = 0> class X;
```
@guwirth guwirth merged commit e6a5f9e into SonarOpenCommunity:master Feb 24, 2022
@guwirth guwirth deleted the fix-2317 branch July 26, 2022 09:07
@guwirth guwirth restored the fix-2317 branch July 26, 2022 09:15
@guwirth guwirth deleted the fix-2317 branch July 26, 2022 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Parsing error when using template type parameter with assignment

1 participant