[llvm-bugs] [Bug 25182] New: Typedef return type + Fully Qualified name for a member function causes error in out-of-line definition

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 14 07:32:06 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25182

            Bug ID: 25182
           Summary: Typedef return type + Fully Qualified name for a
                    member function causes error in out-of-line definition
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: a at gha.st
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

When defining a member function out of line with its fully qualified name and a
return type that is a type alias, clang will cause an error.

Consider the following example:

// compiled with clang++ -std=c++14 file.cpp
using test_t = int;

struct S { test_t f(); };

// This will error out with:
// error: 'test_t' (aka 'int') is not a class, namespace, or enumeration
test_t ::S::f() { return 0; }

// Defining it like this will compile correctly:
// test_t S::f() { return 0; }

// The following also works:
// int ::S::f() { return 0; }


// a main function so it links correctly:
int main() { }


This bug appears with both the following clang++ versions:

$ clang++ -v
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.2.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64


$ clang++ -v
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151014/ce395402/attachment.html>


More information about the llvm-bugs mailing list