LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12940 - redundant error when redefining a function as deleted
Summary: redundant error when redefining a function as deleted
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++11 (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: David Blaikie
URL:
Keywords: quality-of-implementation
Depends on:
Blocks:
 
Reported: 2012-05-24 15:33 PDT by David Blaikie
Modified: 2012-07-16 14:06 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Blaikie 2012-05-24 15:33:43 PDT
Given:

  void func() { }
  void func() = delete;

Clang produces:

  spec.cpp:2:6: error: redefinition of 'func'
  void func() = delete;
       ^
  spec.cpp:1:6: note: previous definition is here
  void func() { }
       ^
  spec.cpp:2:15: error: deleted definition must be first declaration
  void func() = delete;
                ^
  spec.cpp:1:6: note: previous declaration is here
  void func() { }
       ^

Essentially the same diagnostic twice. Either we could simply suppress the second diagnostic when we know the function is already defined (& thus we already produced the first diagnostic), or suppress the first diagnostic when the new definition is deleted and, possibly, make the "deleted definition must be first" diagnostic have some more specific text for this case (based on the same property as the first option: that there's already a definition)
Comment 1 David Blaikie 2012-06-27 13:11:21 PDT
Out for review.
Comment 2 David Blaikie 2012-07-16 14:06:30 PDT
Fixed by r159442