[LLVMbugs] [Bug 16159] New: "incomplete" error message when trying to use a pointer with no linkage as a template argument

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 27 14:07:33 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16159

            Bug ID: 16159
           Summary: "incomplete" error message when trying to use a
                    pointer with no linkage as a template argument
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Given

template <int *I> void foo() {}
void *zed() {
  static int X;
  foo<&X>();
}

we say

----------------------------------------------------------
test.cpp:4:3: error: no matching function for call to 'foo'
  foo<&X>();
  ^~~~~~~
test.cpp:1:24: note: candidate template ignored: invalid explicitly-specified
argument for template parameter 'I'
template <int *I> void foo() {}
---------------------------------------------------------

gcc trunk says

------------------------------------------------
/home/espindola/llvm/test.cpp: In function ‘void* zed()’:
/home/espindola/llvm/test.cpp:4:11: error: ‘& X’ is not a valid template
argument of type ‘int*’ because ‘X’ has no linkage
   foo<&X>();
           ^
/home/espindola/llvm/test.cpp:4:11: error: no matching function for call to
‘foo()’
/home/espindola/llvm/test.cpp:4:11: note: candidate is:
/home/espindola/llvm/test.cpp:1:24: note: template<int* I> void foo()
 template <int *I> void foo() {}
                        ^
/home/espindola/llvm/test.cpp:1:24: note:   substitution of deduced template
arguments resulted in errors seen above
-------------------------------------------------------

Saying something about &X being invalid for not having linkage makes the error
a lot easier to understand.

-- 
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/20130527/501fffa8/attachment.html>


More information about the llvm-bugs mailing list