Skip to content

An other preprocessing bug (probably). #1822

@jfjlaros

Description

@jfjlaros

Describe the problem

A sketch containing a function that makes use of a type created with typedef does not compile under certain circumstances. This issue may be related to bug #1785.

To reproduce

When the following sketch is compiled,

void somefunction() {}
typedef int myInt;
void myTest(myInt) {}

void setup() {}
void loop() {}

this error is raised:

.../x.ino:3:18: error: variable or field 'myTest' declared void
 void myTest(myInt) {}
                  ^
.../x.ino:3:13: error: 'myInt' was not declared in this scope
 void myTest(myInt) {}
             ^~~~~

When the first two lines are swapped, the sketch compiles fine.

typedef int myInt;
void somefunction() {}
// ...

Expected behavior

Both sketches are expected to compile. For reference, the following code compiles without any errors or warnings

void somefunction() {}
typedef int myInt;
void myTest(myInt) {}

int main() {
  return 0;
}

with the following command:

g++ -std=c++11 -Wall -Wextra -pedantic x.cc

Arduino CLI version

nightly-20220803 Commit: 2dd8976 Date: 2022-08-03T01:36:48Z

Operating system

Linux

Operating system version

Debian bookworm/sid

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

conclusion: duplicateHas already been submittedtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy