-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
| Bugzilla Link | 20296 |
| Version | 3.4 |
| OS | All |
| Attachments | source files used in the description |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@zahiraam |
Extended Description
When trying to compile the following program:
cat tmp.cpp
template <template<typename A> class T>
class E {
public:
typedef T<E> EType;
};
class Foo {
public:
template<typename A>
struct Nested { };
private:
typedef Foo Type;
typedef E<Nested>::EType EType;
public:
typedef void (*MethodType)(EType& n);
public:
static void adaptMethod(EType& n);
public:
Foo()
: _method(&Type::adaptMethod) { }
private:
MethodType _method;
};I get:
clang++ -v -c -std=c++11 tmp.cpp
clang version 3.4 (http://llvm.org/git/clang 48eff6c3512fd6c768072b05ab4c287c7719072b) (http://llvm.org/git/llvm 8240ef04108620fef51219e9495a6e71e95ccd75)
Target: x86_64-unknown-linux-gnu
Thread model: posix
"/dbc/sof2-dbc201/gdimitrov/sysroot/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name tmp.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.20.51.0.2 -v -coverage-file /dbc/sof2-dbc201/gdimitrov/git-src/cayman/vapicpp_cfg/vapicpp/src/tmp.o -resource-dir /dbc/sof2-dbc201/gdimitrov/sysroot/bin/../lib/clang/3.4 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/x86_64-redhat-linux/c++/4.4.7 -internal-isystem /usr/local/include -internal-isystem /dbc/sof2-dbc201/gdimitrov/sysroot/bin/../lib/clang/3.4/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /dbc/sof2-dbc201/gdimitrov/git-src/cayman/vapicpp_cfg/vapicpp/src -ferror-limit 19 -fmessage-length 318 -mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o tmp.o -x c++ tmp.cpp
clang -cc1 version 3.4 based upon LLVM 3.4svn default target x86_64-unknown-linux-gnu
tmp.cpp:20:16: warning: function 'Foo::adaptMethod' has internal linkage but is not defined [-Wundefined-internal]
static void adaptMethod(EType& n);
^
tmp.cpp:24:24: note: used here
: _method(&Type::adaptMethod) { }
^
1 warning generated.
The same code compiles fine with clang 3.2 and gcc 4.4, 4.8
If I change the code to this:
% cat tmp2.cpptemplate <template<typename A> class T>
class E {
public:
typedef T<E> EType;
};
template<typename A>
struct Nested { }; // Moved the class outside of Foo
class Foo {
public:
private:
typedef Foo Type;
typedef E<Nested>::EType EType;
public:
typedef void (*MethodType)(EType& n);
public:
static void adaptMethod(EType& n);
public:
Foo()
: _method(&Type::adaptMethod) { }
private:
MethodType _method;
};Or I change it to this:
cat tmp3.cpp
template <template<typename A> class T>
class E {
public:
typedef T<int> EType; // use "int" instead of "E"
};
class Foo {
public:
template<typename A>
struct Nested { };
private:
typedef Foo Type;
typedef E<Nested>::EType EType;
public:
typedef void (*MethodType)(EType& n);
public:
static void adaptMethod(EType& n);
public:
Foo()
: _method(&Type::adaptMethod) { }
private:
MethodType _method;
};There is no warning issued.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer