Skip to content

Extract to function (and Create Declaration/Definition) have #pragma once missing for a blank header #11460

Open
@sean-mcmanus

Description

@sean-mcmanus
  1. Use Extract to function or Create Declaration/Definition on a source file that has no header file.
  2. Notice the created header has a #pragma once added.
  3. Do an undo to undo the edits. Note: Undo of the file creation seems to not work (I get Unable to create file 'test.h' that already exists when overwrite flag is not set, see Undo of header file creation from Extract to function or Create Declaration / Definition gives an error #11462).
  4. Use another Extract to function or Create Declaration/Definition command.

Bug: The 2nd command doesn't add the #pragma once that the 1st command had added. It seems like the empty file and non-existent file cases should behave the same. Ideally, it would check if the existing file already has a #pragma once or an include guard at the top, and if not, add the #pragma once. This also repros with VS.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions