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 16875 - referencing member of the current instantiation with a deduced return type
Summary: referencing member of the current instantiation with a deduced return type
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++14 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 16884 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-13 12:59 PDT by Richard Smith
Modified: 2013-08-14 17:57 PDT (History)
1 user (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 Richard Smith 2013-08-13 12:59:51 PDT
Clang rejects this:

template<typename T> struct X {
  auto f() { return 0; }
  void g() { f(); }
};

saying:

<stdin>:3:14: error: function 'f' with deduced return type cannot be used before it is defined
  void g() { f(); }
             ^

This isn't right: we should be allowed to reference this function as a member of the current instantiation. We should probably deduce the return type to DependentTy when the template is defined.
Comment 1 Richard Smith 2013-08-14 16:00:40 PDT
Fixed in r188410.
Comment 2 Gonzalo BG 2013-08-14 17:57:42 PDT
*** Bug 16884 has been marked as a duplicate of this bug. ***