[LLVMbugs] [Bug 21020] New: Clang 3.5 incorrect error: declaration of reference variable requires an initializer
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Sep 21 12:58:44 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=21020
Bug ID: 21020
Summary: Clang 3.5 incorrect error: declaration of reference
variable requires an initializer
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: wtt6 at cornell.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
See code and output below. The code is accepted as is by clang 3.4. Clang 3.5
accepts it if either commented line is substituted for its preceeding line or
if the function g() is made non-templated.
$ cat test.cpp
struct foo { foo(int) {} };
//typedef char foo;
template <class>
void g()
{
int x;
const foo& y(x);
//const foo& y = x;
}
void f() {
g<int>();
}
$ clang+llvm-3.5.0-x86_64-linux-gnu/bin/clang++ -fsyntax-only test.cpp
test.cpp:8:14: error: declaration of reference variable 'y' requires an
initializer
const foo& y(x);
^
test.cpp:13:3: note: in instantiation of function template specialization
'g<int>' requested here
g<int>();
^
1 error generated.
--
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/20140921/c5b35df9/attachment.html>
More information about the llvm-bugs
mailing list