[LLVMbugs] [Bug 12583] New: declval() with incomplete type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 17 21:46:58 PDT 2012


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

             Bug #: 12583
           Summary: declval() with incomplete type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abominable-snowman at yandex.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Wrong report about 'incomplete type'. Situation has relation to type selection
technique.

Key string in the example is

template <class T>
static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );

First declval (declval<typename T::pointer>) and comma operator required for
problem demonstration. Another condition is usage of x-pair<int,Incomplete>.


For testcase, see attached file. Compilation:

clang++ -std=gnu++0x -c test.cc
test.cc:47:7: error: field has incomplete type 'Incomplete'
    B b;
      ^
test.cc:27:52: note: in instantiation of template class 'x_pair<int,
Incomplete>' requested here
    static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );
                                                   ^
test.cc:27:76: note: while substituting explicitly-specified template arguments
into function template
      '__test_p'
    static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );
                                                                           ^
test.cc:64:22: note: in instantiation of template class
'x_allocator_traits<my_t_alloc_p<x_pair<int,
      Incomplete> > >' requested here
    typedef typename x_allocator_traits<my_t_alloc_p<x_pair<int,Incomplete> >
>::pointer pointer6;
                     ^
test.cc:50:8: note: definition of 'Incomplete' is not complete until the
closing '}'
struct Incomplete
       ^
1 error generated.


(the same problem for gcc: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52108)

-- 
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