[LLVMbugs] [Bug 10177] New: non-type template arguments to alias templates which don't appear in the expansion are not marked as used in dependent contexts

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 23 08:22:45 PDT 2011


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

           Summary: non-type template arguments to alias templates which
                    don't appear in the expansion are not marked as used
                    in dependent contexts
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Consider the following:


#include <iostream>

template<typename T, typename U, U> using alias_ref = T;

template<typename T>
struct U {
  static int a;
};

template<typename T>
int U<T>::a = (std::cout << "called" << std::endl, 0);

template<typename T>
void f() {
  alias_ref<int, int&, U<int>::a> a;
};

int main() {
  f<int>();
}


Here, the definition of U<int>::a should be instantiated, since it is odr-used.
However, clang does not instantiate it. Presumably we're canonicalizing the
type of f<T>'s 'a' variable to 'int' at some point and thus not noticing that
U<int>::a is used.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list