[LLVMbugs] [Bug 13835] New: auto keyword introduces bogus type-dependency in expressions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 13 06:54:51 PDT 2012


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

             Bug #: 13835
           Summary: auto keyword introduces bogus type-dependency in
                    expressions
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicola.gigante at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9202
  --> http://llvm.org/bugs/attachment.cgi?id=9202
Minimal test-case

The following piece of code, accepted by gcc, doesn't compile on clang:

class A
{
public:
   template<typename T>
   int method() { return 0; }

   A a();
};

template<typename T>
class B
{
   A _a;

public:
   int method()
   {
        auto a = _a.a();
        return a.method<int>();
   }
};

with the following error:

$clang++ -std=c++11 -fsyntax-only bug.cpp
bug.cpp:19:18: error: use 'template' keyword to treat 'method' as a dependent
template name
        return a.method<int>();
                 ^
                 template 
1 error generated.

It seems that the auto keyword makes the 'a' expression type-dependent, which
seems wrong (If I'm not missing any semantic caveat of the auto keyword).
Actually, specifying the type without 'auto' resolves the problem.

This is a reduced test-case from a piece of code in the VexCL library, that
can't be compiled with clang because of this issue.

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